Use ArgumentNullException.ThrowIfNull()
Recipe ID
OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net6.UseThrowIfNullArtifactOpenRewrite.Recipes.CSharp.Migration.DotnetReplace if (x == null) throw new ArgumentNullException(nameof(x)) guard clauses with ArgumentNullException.ThrowIfNull(x) (CA1510). Handles == null, is null, reversed null ==, string literal param names, and braced then-blocks. Available since .NET 6.
Single recipemodernizationcsharpdotnetProprietary
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.UseThrowIfNullIf the recipe isn’t available locally, install it with:
mod config recipes nuget install OpenRewrite.Recipes.CSharp.Migration.Dotnet