dotnet / dotnet/core

[.NET 8] Known Native AOT Issues

Open
#8,288 0 comments 0 reactions 0 assignees View on GitHub
announcement
Dominant language
PowerShell
Stars
22k
Forks
4.9k
Avg merge
5d 5h
Merged PRs (30d)
29

Description

This issue outlines the set of features that are not yet supported fully in applications that have been AoT compiled to native code.

If you encounter problems in a preview that are not in the list below, please file an issue in the appropriate repo.

- [ASP.NET Core](https://github.com/dotnet/aspnetcore)
- [.NET](https://github.com/dotnet/runtime)

## 8.0-preview4

### Request Delegate Generator
- The `Produces` and `Accepts` metadata are not automatically added to endpoint metadata for a given endpoint. See https://github.com/dotnet/aspnetcore/issues/46277.
- The generated code does not support parameters marked with `AsParameters`. See https://github.com/dotnet/aspnetcore/issues/46336.
- The generated code does not support route handlers that return an anonymous type. See https://github.com/dotnet/aspnetcore/issues/47244.
- The generated code does not support generic types from outer scope. See https://github.com/dotnet/aspnetcore/issues/47338
- The generated code does not support private parameter and return types. See https://github.com/dotnet/aspnetcore/issues/47339
- The generated code does not support having two endpoints with the route handlers that only differ in nullability annotations. See https://github.com/dotnet/aspnetcore/issues/46622.
- The `IEndpointRouteBuilder.Map` and `IEndpointRouteBuilder.MapMethods` overloads are not supported. See https://github.com/dotnet/aspnetcore/issues/47196.
- The generated code does not respect configured `JsonSerializerOptions` when reading from the request body. See https://github.com/dotnet/aspnetcore/issues/47145.

### System.Text.Json
- Publishing for Native AOT requires that all JSON (de)serialization use the JSON Source Generator. Any [existing issues with the JSON Source Generator](https://github.com/dotnet/runtime/issues?q=is%3Aissue+is%3Aopen+label%3Aarea-System.Text.Json+label%3Asource-generator) is also an issue for Native AOT.
- Anonymous Types cannot be source generated
- Compiler generated types, for example for `IAsyncEnumerable`, do not work. https://github.com/dotnet/runtime/issues/84260
- Deserializing and serializing enums with strings are not AOT-safe https://github.com/dotnet/runtime/issues/79311

8.0-preview3
### Request Delegate Generator
- The `Produces` and `Accepts` metadata are not automatically added to endpoint metadata for a given endpoint. See https://github.com/dotnet/aspnetcore/issues/46277.
- The generated code will not log, or throw exceptions in development mode, when parameter binding fails. Instead, the request will return a `400` status code. See https://github.com/dotnet/aspnetcore/issues/46362.
- The generated code does not support parameters marked with `AsParameters`. See https://github.com/dotnet/aspnetcore/issues/46336.
- The generated code does not support parameters processed as form data via `IFormCollection`, `IFormFile`, or `FromForm`. See https://github.com/dotnet/aspnetcore/issues/47200.
- The generated code does not support route handlers that return an anonymous type. See https://github.com/dotnet/aspnetcore/issues/47244.
- The generated code does not support generic types from outer scope. See https://github.com/dotnet/aspnetcore/issues/47338
- The generated code does not support private parameter and return types. See https://github.com/dotnet/aspnetcore/issues/47339
- The generated code does not respect the `RouteHandlerOptions.ThrowOnBadRequest` property. See https://github.com/dotnet/aspnetcore/issues/46362.
- The generated code does not support having two endpoints with the route handlers that only differ in nullability annotations. See https://github.com/dotnet/aspnetcore/issues/46622.
- The `IEndpointRouteBuilder.Map` and `IEndpointRouteBuilder.MapMethods` overloads are not supported. See https://github.com/dotnet/aspnetcore/issues/47196.
- The generated code does not respect configured `JsonSerializerOptions` when reading from the request body. See https://github.com/dotnet/aspnetcore/issues/47145.
- Generation fails when default parameter values are provided. See https://github.com/dotnet/aspnetcore/issues/47266

### System.Text.Json
- Publishing for Native AOT requires that all JSON (de)serialization use the JSON Source Generator. Any [existing issues with the JSON Source Generator](https://github.com/dotnet/runtime/issues?q=is%3Aissue+is%3Aopen+label%3Aarea-System.Text.Json+label%3Asource-generator) is also an issue for Native AOT.
- Anonymous Types cannot be source generated
- Compiler generated types, for example for `IAsyncEnumerable`, do not work. https://github.com/dotnet/runtime/issues/84260
- Deserializing and serializing enums with strings are not AOT-safe https://github.com/dotnet/runtime/issues/79311


### Other
The following areas do not have AoT support at the moment.

- Authentication (JwtBearer coming soon)
- SignalR
- MVC
- Blazor Server

See also https://learn.microsoft.com/dotnet/core/deploying/native-aot/

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.