Use ArgumentNullException.ThrowIfNull()
ProprietaryReplace 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.
OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net6. UseThrowIfNullmod run . --recipe= OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net6. UseThrowIfNullInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.