dotnet / dotnet/android

NativeAOT - Build fails when building with Release config

Open
#10,218 1 comment 0 reactions 0 assignees View on GitHub
Area: App+Library Build
Dominant language
C#
Stars
2.1k
Forks
579
Avg merge
1d 19h
Merged PRs (30d)
252

Description

[msbuild.zip](https://github.com/user-attachments/files/20783576/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 `` allows build to succeed and app to run.

### Relevant log output
Here is a binlog
[msbuild.zip](https://github.com/user-attachments/files/20783579/msbuild.zip)

```shell

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.