Use generic Marshal.PtrToStructure for explicitly cast closed source structs
ProprietaryReplace resolved explicitly cast PtrToStructure(pointer, typeof(T)) calls with the generic overload for the same closed source struct on known .NET Framework 4.5.1+, .NET Standard 1.2+ or .NET Core 1.0+ targets. Preserve the explicit cast, pointer evaluation, source ownership and target evidence. Skip generic types, reference types, ambiguous projects, old language syntax, comments and conditional snapshots.
OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net5. UseGenericMarshalPtrToStructureForSourceStructsmod run . --recipe= OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net5. UseGenericMarshalPtrToStructureForSourceStructsInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.