Use Marshal.GetLastPInvokeError

Proprietary

Replace resolved Marshal.GetLastWin32Error() with GetLastPInvokeError(), the same cached PInvoke error accessor under its platform neutral name, on exclusively .NET 6+ targets. Preserve conditional snapshots, comments, source shadows, external aliases, missing target evidence and old language syntax.

OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net6.UseGetLastPInvokeError
mod run . --recipe=OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net6.UseGetLastPInvokeError

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