You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If target runtime supports allows ref struct constraints, generic anonymous delegate types will include allows ref struct constraint for their type parameters. This will enable substitution of those type parameters with ref struct types and other type parameters with allows ref struct constraint.
A type parameter bound by allows ref struct has all of the behaviors of a ref struct type:
Instances of it cannot be boxed
Instances participate in lifetime rules like a normal ref struct
The type parameter cannot be used in static fields, elements of an array, etc ...
Instances can be marked with scoped
Any usage of the delegate with an ref-like type as typeargument would be invalid. Currently the runtime simply does not care (and roslyn enforces that such delegate types can't be declared by a user).
Version Used:
Steps to Reproduce:
Compile the following code:
Expected Behavior:
The compiler should generate an unspeakable delegate type like:
Actual Behavior:
It generates code like:
If you look in dotPeek for example and have a look at the TypeParameter flags you can see 0x0020 is set.
The value is defined here: it means
allows ref struct
The text was updated successfully, but these errors were encountered: