ASP.NET Core Web API (Native AOT) project fail to serialize the object to JSON #59659
Closed
1 task done
Labels
area-mvc
Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Is there an existing issue for this?
Describe the bug
Environment:
Visual Studio Community 2022 17.12.3
Win10 + .NET SDK 8
I created an ASP.NET Core Web API (Native AOT) project in Visual Studio using .NET 8. The minimal API endpoints below worked as expected:
After moving the endpoints to
TodosController.cs
and configuring the JSON serializer in a separate fileJsonTypeMetaData.cs
, I encountered the following exception:TodosController.cs
:JsonTypeMetaData.cs
:Program.cs
:WebApplication.csproj
I tried a similar solution (#59128), but it didn't work for me. Any help would be greatly appreciated.
Expected Behavior
No response
Steps To Reproduce
The mini project:
WebApplication1.zip
Exceptions (if any)
No response
.NET Version
dotnet 8.0.404
Anything else?
No response
The text was updated successfully, but these errors were encountered: