Scope reviewed copy-only in parameters of closed ref-struct constructors
ProprietaryAdd only scoped to a single in parameter of an internal/private nested ref-struct constructor. Require a readonly nonpartial outer ref struct and bound readonly source field value reads in a closed assignment/literal/value-constructor body. Reject properties, aliases, captures, ref storage, unknown calls, initializers, partial owners and conditional snapshots. Standalone opt-in; source-only proof, not whole-application compiler validation.
OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net7. ScopeInCopyOnlyRefStructConstructorsOptional
Confirm C# 11 or newer for ALL affected builds and consumers, and review constructor annotation/reflection/ABI and deployed runtime metadata compatibility policy. Target frameworks do not establish compiler versions. ScopedRefAttribute and ref-safety metadata deliberately change. Default false.
mod run . --recipe= OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net7. ScopeInCopyOnlyRefStructConstructorsInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.