-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ByRef-like structs can be passed via __arglist but not retrieved #79065
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
This is "by-design" at present. The issue here is ByRef like types are not presently supported in this part of the stack nor in any Reflection-esque APIs. Additionally the As far as why this isn't naturally supported is a |
Tagging subscribers to this area: @dotnet/area-system-reflection Issue DetailsDescriptionCalling Reproduction StepsSpan<byte> s1 = stackalloc byte[1];
Span<byte> s2 = stackalloc byte[2];
Span<byte> s3 = stackalloc byte[3];
Method(__arglist(s1, s2, s3));
static void Method(__arglist)
{
var ai = new ArgIterator(__arglist);
while(ai.GetRemainingCount() > 0)
{
var tr = ai.GetNextArg();
var val = __refvalue(tr, Span<byte>);
Console.WriteLine(val.Length);
}
} Expected behaviorThe value should be extracted, since C# itself allows you to pass the struct and retrieve the value without complaining, and it is not possible for the returned Actual behaviorSystem.NotSupportedException: 'Type is not supported.' is thrown from Regression?No response Known WorkaroundsNo response Configuration.NET 6 Other informationNo response
|
Moving to future. When the other higher-priority byref-like issues are resolved, this will be considered. |
Description
Calling
ArgList.GetNextArg
fails if the argument passed through__arglist
has a ByRef-like type.Reproduction Steps
Expected behavior
The value should be extracted, since C# itself allows you to pass the struct and retrieve the value without complaining, and it is not possible for the returned
TypedReference
to escape the method anyway.Actual behavior
System.NotSupportedException: 'Type is not supported.' is thrown from
GetNextArg
.Regression?
No response
Known Workarounds
No response
Configuration
.NET 6
Other information
No response
The text was updated successfully, but these errors were encountered: