Issue with FluentUI in Blazor WASM: Deserialization Error on Deployed App

Vũ Hoàng 0 Reputation points
2024-06-17T17:15:14.9066667+00:00

I'm experiencing a deserialization error with FluentUI components in my Blazor WASM web app. The error only occurs on the deployed app (on Azure Static Web App), not in the localhost development environment. I'm using the FluentUI framework for UI components, and the error message in the browser console is as follows:

Uncaught (in promise) Error: System.InvalidOperationException: There was an error parsing the event arguments. EventId: '30'.
 ---> System.NotSupportedException: DeserializeNoConstructor, JsonConstructorAttribute, Microsoft.FluentUI.AspNetCore.Components.AccordionChangeEventArgs Path: $ | LineNumber: 0 | BytePositionInLine: 1.
 ---> System.NotSupportedException: DeserializeNoConstructor, JsonConstructorAttribute, Microsoft.FluentUI.AspNetCore.Components.AccordionChangeEventArgs
   Exception_EndOfInnerExceptionStack
   at System.Text.Json.ThrowHelper.ThrowNotSupportedException(ReadStack& , Utf8JsonReader& , NotSupportedException )
   at System.Text.Json.ThrowHelper.ThrowNotSupportedException_DeserializeNoConstructor(Type , Utf8JsonReader& , ReadStack& )
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1[[Microsoft.FluentUI.AspNetCore.Components.AccordionChangeEventArgs, Microsoft.FluentUI.AspNetCore.Components, Version=4.7.1.24114, Culture=neutral, PublicKeyToken=null]].OnTryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , AccordionChangeEventArgs& )

This error seems to appear when the app tries to render a FluentUI component.

What I've Tried

  1. Ensured Version Consistency: Verified that the same version of FluentUI is used in both development and production environments.
  2. Checked Serialization Settings: Made sure that the serialization settings are consistent.
  3. Deployment Configuration: Double-checked the deployment process to ensure all necessary files and configurations are included.
  4. Updated FluentUI: Ensured that the latest stable version of FluentUI is being used.

Environment Details

  • Development Environment: Works fine without any errors.
  • Production Environment: Throws the deserialization error mentioned above.

How can I resolve the deserialization error related to AccordionChangeEventArgs in my Blazor WASM web app when using FluentUI components? Has anyone faced a similar issue and found a solution or workaround?

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,456 questions
0 comments No comments
{count} votes