Description
The size of an InlineArray is supposed to be limited to 1MiB, but the example below slips through:
[InlineArray(2)]
struct BigArray
{
BigElement element;
}
[StructLayout(LayoutKind.Sequential, Size = int.MaxValue)]
struct BigElement
{
}
Reproduction Steps
Given the type definitions from earlier:
unsafe { Console.WriteLine(sizeof(BigArray)); }
Expected behavior
The runtime should throw a TypeLoadException.
Actual behavior
No exception occurs, and sizeof(BigArray) returns -2.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response