Use static random fill for a fresh array inside a closed provider block
ProprietaryReplace a parameterless BCL RNGCryptoServiceProvider using block starting with one fresh byte[] local and a sole GetBytes(byte[]) call with an ordinary block and RandomNumberGenerator.Fill. Retain the allocation and following consumers/setters. Require one provider reference; skip unknown/shared buffers, other factories/providers, nonzero/ranged/multiple calls, comments, captures/ref/unsafe/async and conditional snapshots. Opt-in modern API port; no algorithm, key-size, seed or ownership policy change.
OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net6. UseClosedBodyRandomFillmod run . --recipe= OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net6. UseClosedBodyRandomFillInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.