Use generic Marshal.PtrToStructure for explicitly cast BCL scalars

Proprietary

Replace resolved explicitly cast PtrToStructure(pointer, typeof(T)) calls with the generic overload for the same fixed BCL scalar on exclusively .NET 5+ targets. Preserve the explicit cast, pointer evaluation and target evidence. Retain nullable/mismatched casts, object results, unknown types/projects, old language syntax, comments, deferred contexts and conditional snapshots.

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

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