Use generic Marshal.OffsetOf for closed source struct types

Proprietary

Replace resolved OffsetOf(typeof(T), fieldName) with the generic forwarding overload for closed source struct types on known .NET Framework 4.5.1+, .NET Standard 1.2+ or .NET Core 1.0+ targets. Preserve the field expression and marshalling layout; retain type variables, constructed generics, ref structs, old language syntax, shadows, comments and conditional snapshots.

OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net5.UseGenericMarshalOffsetOfForSourceStructs
mod run . --recipe=OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net5.UseGenericMarshalOffsetOfForSourceStructs

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