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

Activity

  1. dotnet-policy-service commented on Jun 30, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib
    See info in area-owners.md if you want to be subscribed.

  2. MichalStrehovsky commented on Jul 1, 2026

    @MichalStrehovsky
    Member

    Fixed in #130019.

  3. locked and limited conversation to collaborators on Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

  • Status
    No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions