-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Open
Labels
Milestone
Description
Description
This is somewhat a duplicate of ...
... which state that is should be fixed with .NET 8 but the code below crashes with 9.0.4
Is this an oversight? Is this a known issue?
The TypeLoadException thrown is so information-less and it took me some time to track it down. I would really appreciate it if TypeLoadException could give some hint or clue about what went wrong and if it's just printing the word "circular", "missing", "mismatch" or something. Or the JIT compiler just prints a line via OutputDebugString. At least something more than 🤷.
Reproduction Steps
using System.Collections.Immutable;
_ = Crash.Me;
public struct Crash
{
public static readonly ImmutableArray<Crash> Me;
}
Expected behavior
throw new TypeLoadException("circular reference of type 'Crash' detected which is not supported")
or
no issue anymore, works fine since NET 8
Actual behavior
throw new TypeLoadException() + 🤷
Regression?
no regression
Known Workarounds
ImmutableArray<T> --> T[]
works just fine
Configuration
.NET 9.0.4
Other information
No response