Use the default RNG factory in an explicitly typed using block
ProprietaryPort a parameterless RNGCryptoServiceProvider in an explicitly typed using resource to RandomNumberGenerator.Create(), updating the declared type and bound local references while retaining the original disposal block. Require only resolved byte-array GetBytes/GetNonZeroBytes uses. Leave escapes, identity/configuration members, captures, other scope forms, commented type syntax and conditional snapshots unchanged. Opt-in modern-.NET compatibility port.
OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net6. UseExplicitScopedRandomNumberGeneratormod run . --recipe= OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net6. UseExplicitScopedRandomNumberGeneratorInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.