-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Milestone
Description
Originally defined in #81741, Generic support in UnsafeAccessorAttribute scenarios was not added. This issue tracks that effort across the runtimes.
- CoreCLR - [CoreCLR and native AOT]
UnsafeAccessorAttributesupports generic parameters #99468 - NativeAOT - [CoreCLR and native AOT]
UnsafeAccessorAttributesupports generic parameters #99468 - Mono - [mono] Implement generic support for
UnsafeAccessorAttribute#99830 - Update official documentation for
UnsafeAccessorAttribute- Add examples for generic support. dotnet-api-docs#9746
For bound generic parameters this was originally thought to work but was broken after the final signature validation logic was implemented. This was reported in #92633 as a regression. That issue has been subsequently closed and folded into this work to support Generics on bound parameters too.
[UnsafeAccessor(UnsafeAccessorKind.Field, Name="_myList")]
static extern ref List<string> StringField(MyClass<string> _this);
[UnsafeAccessor(UnsafeAccessorKind.Field, Name="_myList")]
static extern ref List<double> DoubleField(MyClass<double> _this);Example with unbound generic parameters.
[UnsafeAccessor(UnsafeAccessorKind.Field, Name="_myList")]
static extern ref List<T> Field<T>(MyClass<T> _this);KeterSCP, MichalPetryka, thatbakamono, Windows10CE, PaulusParssinen and 30 moreTimovzl
Metadata
Metadata
Assignees
Type
Projects
Status
No status