Use AsyncLocal for closed Boolean logical context flags
ProprietaryOpt-in in-process port of a static Boolean property backed only by a private constant CallContext slot: (bool?)LogicalGetData(key) ?? false and LogicalSetData(key,value). Require exactly the declaration and two bound key references, one matching literal and no other CallContext operations/type references in the file. Keep the property and caller symbols, use a private AsyncLocal<bool> field initialized first. Exclude partial/generic owners, dynamic/shared keys, arbitrary objects, other context operations, special correlation-manager slots, comments, imports requiring rewriting and conditional files. External named-slot and remoting interoperability are not preserved; review those contracts before opting in.
OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net3_0. UseAsyncLocalForClosedBooleanContextFlagsmod run . --recipe= OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net3_0. UseAsyncLocalForClosedBooleanContextFlagsInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.