Migrating a Blazor Hosted App from .NET 7 to .NET 8 is giving a serialization error

23 views Asked by At

I migrated our Blazor WASM Hosted application from .NET 7 to .NET 8.

The application compiles fine, but when I run it and then call any of the action methods in the web api (server project), I am getting an exception as follows:

System.NotSupportedException: JsonTypeInfo metadata for type 'System.Collections.Generic.IEnumerable'1[Test.Shared.ListItem'1[System.String]]' was not provided by TypeInfoResolver of type '[]'.

When I call the wep api from Postman I am getting the same error.

I tried with endpoints that returns primitive types and they work fine. The issue only happens when the response is a json object. I tried adding the JsonSerializable attribute but I am getting the samae error. I know that this should be required because by default all serialization should be performed by the System.Text.Json.

0

There are 0 answers