-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Support for unsafe accessors of static methods was added in .NET 10 via the new UnsafeAccessorTypeAttribute. The source generator should be updated to leverage that once .NET 10 gets released.
We should update the logic here:
PolyType/src/PolyType.SourceGenerator/Parser/Parser.ModelMapper.cs
Lines 562 to 568 in 648dd23
| CanUseUnsafeAccessors = _knownSymbols.TargetFramework switch | |
| { | |
| // .NET 8 or later supports unsafe accessors for methods of non-generic types. | |
| // .NET 10 or later supports unsafe accessors for static methods cf. https://github.com/eiriktsarpalis/PolyType/issues/220 | |
| var target when target >= TargetFramework.Net80 => !m.Method.ContainingType.IsGenericType && !m.Method.IsStatic, | |
| _ => false | |
| }, |
such that
net10.0 targets also support static methods for unsafe accessors. Then the codegen should take advantage of the new UnsafeAccessorTypeAttribute.Copilot
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request