Static field in value type with empty generic causes TypeLoadException
#88030
Labels
Milestone
TypeLoadException
#88030
Description
When loading the
Bar
type, aTypeLoadException
is thrown.Reproduction Steps
Expected behavior
I expect the type to load successfully, or at the very least for it to be a compile time diagnostic, rather than a runtime exception.
Actual behavior
TypeLoadException
at runtime.Regression?
I don't know any specifics, but testing on SharpLab shows that it's been broken on all .NET (Framework & Core) versions.
Known Workarounds
Moving the static field to a different type. For example:
Alternatively, making either type a
class
will also workaround the issue.Configuration
No response
Other information
This issue is an overlap of #5479 (but that has an actually recursive type in a static field), and #6924 (which is generally about unused generics).
The other issues are both closed/merged and locked to contributors. Yet the issue remains, hence I'm opening this issue.
The text was updated successfully, but these errors were encountered: