Use ArgumentException.ThrowIfNullOrWhiteSpace()

Proprietary

Replace if (string.IsNullOrWhiteSpace(s)) throw new ArgumentException("...", nameof(s)) guard clauses with ArgumentException.ThrowIfNullOrWhiteSpace(s). Available since .NET 8.

OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.UseThrowIfNullOrWhiteSpace
mod run . --recipe=OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.UseThrowIfNullOrWhiteSpace

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.