Use factory method for abstract cryptographic types
Recipe ID
OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net6.UseCryptoFactoryMethodsArtifactOpenRewrite.Recipes.CSharp.Migration.DotnetReplace new AbstractCryptoType() with AbstractCryptoType.Create() for abstract cryptographic types like SHA256, Aes, RandomNumberGenerator, etc. These types are abstract and cannot be instantiated directly; callers must use the static Create() factory method.
Single recipecsharpdotnetSYSLIB0023SYSLIB0022SYSLIB0021cryptographyProprietary
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net6.UseCryptoFactoryMethodsIf the recipe isn’t available locally, install it with:
mod config recipes nuget install OpenRewrite.Recipes.CSharp.Migration.Dotnet