Skip to content

NativeAOT - Build fails when building with Release config #10218

@emmauss

Description

@emmauss

msbuild.zip

Android framework version

net10.0-android (Preview)

Affected platform version

.Net 10

Description

When building a very large project with native aot using Release config, the build fails with the following error:
EXEC : error : Failed to load type 'System.IO.Stream' from assembly 'System.Runtime, Version=10.0.0.0, Culture=neutral, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293'
Build works fine with Debug config

Steps to Reproduce

  1. Clone and edit this project https://github.com/AvaloniaUI/Avalonia/tree/android_naot/samples/ControlCatalog.Android
  2. Update this property to your SDK path https://github.com/AvaloniaUI/Avalonia/blob/19822f3f62be695906c25dde049c8b21a69f1f03/samples/ControlCatalog.Android/ControlCatalog.Android.csproj#L12
  3. Build with release config. dotnet build -c Release
  4. Build fails on ILCCompile step.

Did you find any workaround?

Setting <TrimmerRootAssembly Include="System.Runtime" RootMode="all" /> allows build to succeed and app to run.

Relevant log output

Here is a binlog
msbuild.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: App+Library BuildIssues when building Library projects or Application projects.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions