Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions doc/features-profiled-aot-validation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
uid: Uno.Wasm.Bootstrap.ProfiledAOTValidation
---

# Troubleshooting Profiled AOT

The .NET WebAssembly AOT compiler uses the AOT profile to determine which methods to compile to WebAssembly. In some cases, which may change depending on the .NET SDK version, selected methods may not be AOT compiled silently and may fall back to the interpreter.

In such cases, the runtime performance of the app may become slower than expected.

The bootstrapper provides a way to log the methods that were not AOT compiled, by setting the following property:

```xml
<PropertyGroup>
<WasmShellAOTProfileValidation>true</WasmShellAOTProfileValidation>
</PropertyGroup>
```

## Assemblies filtering

Assemblies may be skipped entirely from the validation using the following property:

```xml
<PropertyGroup>
<WasmShellAOTProfileValidationExcludedAssemblies>$(WasmShellAOTProfileValidationExcludedAssemblies);System.*</WasmShellAOTProfileValidationExcludedAssemblies>
</PropertyGroup>
```

Entries in the `WasmShellAOTProfileValidationExcludedAssemblies` property are semi-colon separated regular expressions.

## Methods filtering

Specific methods may be skipped entirely from the validation using the following property:

```xml
<PropertyGroup>
<WasmShellAOTProfileValidationExcludedMethods>$(WasmShellAOTProfileValidationExcludedMethods);MyNamespace.MyType.MyMethod.*</WasmShellAOTProfileValidationExcludedMethods>
</PropertyGroup>
```

Entries in the `WasmShellAOTProfileValidationExcludedMethods` property are semi-colon separated regular expressions.

## Conditions when methods are not AOT compiled

### Methods with try/catch/finally blocks

Methods containing `try/catch/finally` blocks are not AOT compiled. `try/finally` and `try/catch` blocks are not impacted.

When this pattern is needed, it's best to separate place the `try/finally` and the `try/catch` in separate methods.

## Build Errors

### UNOW0001

The following error may be raised:

```text
UNOW0001: Method XXX from YYY has not been AOTed, even if present in the AOT profile.
```

This error is raised when the AOT profile requested a method to be AOT compiled, but was not.

### UNOW0002

The following error may be raised:

```text
UNOW0002: The method XXX from YYY is not present in the assembly.
```

This error generally means that there's a problem in the bootstrapper when matching methods from the compiled assemblies. If you find this specific error, please report it by opening an issue.
19 changes: 4 additions & 15 deletions doc/runtime-execution-modes.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ To create a profiled build:

- Build you application again

Note that the AOT profile is a snapshot of the current set of assemblies and methods in your application. If that set changes significantly, you'll need to re-create the AOT profile to get optimal results.
> [!NOTE]
> AOT profile is a snapshot of the current set of assemblies and methods in your application. If that set changes significantly, you'll need to re-create the AOT profile to get optimal results.

More information about [troubleshooting the Profiled AOT mode](xref:Uno.Wasm.Bootstrap.ProfiledAOTValidation) is available.

### AOT Profile method exclusion

Expand Down Expand Up @@ -151,20 +154,6 @@ At this time, it is only possible to exclude assemblies from being compiled to W

Adding assemblies to this list will exclude them from being compiled to WebAssembly.

### Troubleshooting Mixed AOT/Interpreter Mode

When using the Mixed AOT/Interpreter mode, it is possible that some methods may not be compiled to WebAssembly for a variety of reasons. This can cause performance issues, as the interpreter is slower than the AOT-generated code.

In order to determine which methods are still using the interpreter, you can use the following property:

```xml
<PropertyGroup>
<WasmShellPrintAOTSkippedMethods>true</WasmShellPrintAOTSkippedMethods>
</PropertyGroup>
```

The logs from the AOT compiler can be found in [binlogs generated](https://aka.platform.uno/msbuild-troubleshoot) from the build.

### Increasing the Initial Memory Size

When building with Mixed AOT/Interpreter modes, the initial memory may need to be adjusted in the project configuration if the following error message appears:
Expand Down
Loading
Loading