-
|
The runtime does not permit // Windows 11 version 24H2 x64 .NET 10.0.
using System;
static class Program
{
private ref struct Wrapper<T> where T : allows ref struct
{
}
public static void M<T>() where T : allows ref struct
{
}
static void CreateType(Type t)
{
try
{
typeof(Wrapper<>).MakeGenericType(t);
Console.WriteLine("CreateType succeeded.");
}
catch (Exception ex)
{
Console.WriteLine("CreateType failed: " + ex.GetType());
}
}
static void CreateMethod(Type t)
{
try
{
typeof(Program).GetMethod(nameof(M)).MakeGenericMethod(t);
Console.WriteLine("CreateMethod succeeded.");
}
catch (Exception ex)
{
Console.WriteLine("CreateMethod failed: " + ex.GetType());
}
}
static void Main()
{
foreach (var t in new[] { typeof(ArgIterator), typeof(RuntimeArgumentHandle), typeof(TypedReference) })
{
Console.WriteLine(t);
CreateType(t);
CreateMethod(t);
// For TypedReference, we get TypeLoadException and BadImageFormatException.
}
}
}
All of those suggest that |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
|
The design doc also mentions The current C# compiler doesn't allow @jkotas This may need to get different teams involved. Can you help for this? |
Beta Was this translation helpful? Give feedback.
I have opened #123626 to amend the documentation to better document the current state. If you would like to see more edits in the ecma augments doc to make this clear, please comment on the PR.
Where do you see this mentioned in the design doc?