Use generic Marshal.SizeOf for closed source layout classes

Proprietary

Replace resolved SizeOf(typeof(T)) with SizeOf<T>() for closed source classes with resolved sequential or explicit StructLayout, owned by the current project on known .NET Framework 4.5.1+, .NET Standard 1.2+ or .NET Core 1.0+ targets. Preserve type attribution, call identity and marshalling metadata. Keep partial, inherited, generic, automatic-layout and external types, ambiguous owners, source shadows, old syntax, comments and conditional snapshots unchanged.

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

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