Skip to content

[.NET10] System.InvalidOperationException: JsonSerializerIsReflectionDisabled thrown with net10 and MSAL/OIDC on WASM #2908

Closed

Description

@kazo0

unoplatform/uno#21585 (comment)

There is currently an issue in the KeyValueStorage that is using reflection based JSON serialization to store the tokens.

A quick, and bad, workaround is to set

<JsonSerializerIsReflectionEnabledByDefault>true</JsonSerializerIsReflectionEnabledByDefault>

Activity

  1. added
    kind/bug
    triage/untriaged
    and removed
    triage/untriaged
    on Oct 10, 2025
  2. added theissue type on Oct 10, 2025
  3. jonpryor commented on Nov 12, 2025

    @jonpryor
    Contributor

    @kazo0: do we have a call stack? Is this from MsalAuthenticationProvider.cs? If so, I may have a pending fix as part of #2899.

  4. changed the title [-]System.InvalidOperationException: JsonSerializerIsReflectionDisabled thrown with net10 and MSAL/OIDC on WASM[/-] [+][.NET10] System.InvalidOperationException: JsonSerializerIsReflectionDisabled thrown with net10 and MSAL/OIDC on WASM[/+] on Nov 25, 2025
  5. removed
    kind/bug
    on Nov 25, 2025
  6. kazo0 commented on Dec 3, 2025

    @kazo0
    ContributorAuthor

    Yes this is still an issue

    UnoApp140.zip

  7. kazo0 commented on Dec 3, 2025

    @kazo0
    ContributorAuthor

    @jonpryor stacktrace:

       at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_JsonSerializerIsReflectionDisabled()
       at System.Text.Json.JsonSerializerOptions.ConfigureForJsonSerializer()
       at System.Text.Json.JsonSerializerOptions.MakeReadOnly(Boolean populateMissingResolver)
       at System.Text.Json.JsonSerializer.GetTypeInfo(JsonSerializerOptions options, Type inputType)
       at System.Text.Json.JsonSerializer.Serialize(Object value, Type inputType, JsonSerializerOptions options)
       at Uno.Extensions.Serialization.SystemTextJsonSerializer.ToString(Object value, Type valueType)
       at Uno.Extensions.Serialization.SerializerExtensions.ToString[String](ISerializer serializer, String value)
       at Uno.Extensions.Storage.KeyValueStorage.ApplicationDataKeyValueStorage.Serialize[String](String value)
       at Uno.Extensions.Storage.KeyValueStorage.ApplicationDataKeyValueStorage.<GetObjectValue>d__35`1[[System.String, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
       at Uno.Extensions.Storage.KeyValueStorage.ApplicationDataKeyValueStorage.<InternalSetAsync>d__36`1[[System.String, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
       at Uno.Extensions.Storage.KeyValueStorage.BaseKeyValueStorageWithCaching.<SetAsync>d__21`1[[System.String, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
       at Uno.Extensions.Authentication.TokenCache.SaveAsync(String provider, IDictionary`2 tokens, CancellationToken cancellation)
       at Uno.Extensions.Authentication.AuthenticationService.LoginAsync(IDispatcher dispatcher, IDictionary`2 credentials, String provider, Nullable`1 cancellationToken)
       at UnoApp140.Presentation.LoginModel.Login(CancellationToken token) in X:\src\TestApps\UnoApp140\UnoApp140\Presentation\LoginModel.cs:line 12
    
  8. rajamatt commented on Jan 22, 2026

    @rajamatt
    Contributor

    No JsonSerializer errors with dev Uno.Sdk 6.5.0-dev.131.


    Tested with:
    Templates/SDK: 6.5.0-dev.131 (which uses Uno version 6.6.0-dev.97)
    Platform(s): Wasm
    IDE: Visual Studio 2026 18.2.1
    OS: Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions