Use generic Marshal.SizeOf for closed source struct types

Proprietary

Replace resolved SizeOf(typeof(T)) with SizeOf<T>() for closed non-ref source structs owned by the current project on known .NET Framework 4.5.1+, .NET Standard 1.2+ or .NET Core 1.0+ targets. Preserve attributed type and call identity, marshalling layout and int result. Keep generic types, classes, pointers, object overloads, old language syntax, source shadows, comments, ambiguous project evidence and conditional snapshots unchanged.

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

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