Use Marshal.GetLastPInvokeError
ProprietaryReplace 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. UseGetLastPInvokeErrormod run . --recipe= OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net6. UseGetLastPInvokeErrorInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.