dotnet / dotnet/runtime

Blazor WASM AOT Compilation Failure

Open
#132,071 6 comments 0 reactions 1 assignee Claimed by @pavelsavara View on GitHub
arch-wasm area-Codegen-AOT-mono needs-author-action os-browser
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

Hi,

We have a problem with Blazor WASM AOT compilation that I cannot seem to diagnose. From ` dotnet publish`, I get the error:
`C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\10.0.10\Sdk\WasmApp.Common.targets(672,5): Error : Precompiling failed for G:\source\xxxx\src\xxxx\obj\Release\net10.0\wasm\for-publish\aot-in\xxxxx.dll with exit code -1073741571.`

The same error appears when building on our Azure DevOps Linux-based agents.

The build output includes the `mono-aot-cross.exe` command that failed. When I run that command directly, I end up with:

```
Failed to load method 0x600014e from 'G:\source\xxxx\src\xxxxx\bin\Release\net10.0\xxxxx.dll' due to Could not resolve type with token 0100001f from typeref (expected class 'System.Collections.Generic.Dictionary`2' in assembly 'System.Collections, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') assembly:System.Collections, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a type:System.Collections.Generic.Dictionary`2 member:(null).
```

The xxxx.dll is a custom .NET 10 library. I am not sure what triggers this problem. How do I find which method _0x600014e_ is, and what type _0100001f_ is?

The .NET version mentioned here is the current insider preview, but the same issue occurs on the latest stable.

### Expected Behavior

Successful compilation, or a more detailed error message pointing to the problem.

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version

10.0.400-preview.0.26322.102

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.