Skip to content

Maximum allowed size of base type in arrays is different in NativeAOT #130018

Description

@hez2010

In CoreCLR, the maximum allowed size of the base type in an array is 65535, so that this is okay:

var array = new Foo[1];
Console.WriteLine(array);

[InlineArray(65535)]
struct Foo { private byte _first; }

With NativeAOT the above limit becomes 65534 somehow so that it will fail at runtime with:

Unhandled exception. System.TypeLoadException: Array of type 'Foo' from assembly 'ConsoleApp1' cannot be created because base value type is too large.

/cc: @MichalStrehovsky

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions