The application will redirect to OIDC IdP with additional parameters passed in /authorize request.
System.NotSupportedException: JsonTypeInfo metadata for type 'System.Collections.Generic.Dictionary`2[System.String,System.String]' was not provided by TypeInfoResolver of type 'Microsoft.AspNetCore.Components.WebAssembly.Authentication.InteractiveRequestOptionsSerializerContext'. If using source generation, ensure that all root types passed to the serializer have been annotated with 'JsonSerializableAttribute', along with any types that might be serialized polymorphically. The unsupported member type is located on type 'System.Object'. Path: $.
---> System.NotSupportedException: JsonTypeInfo metadata for type 'System.Collections.Generic.Dictionary`2[System.String,System.String]' was not provided by TypeInfoResolver of type 'Microsoft.AspNetCore.Components.WebAssembly.Authentication.InteractiveRequestOptionsSerializerContext'. If using source generation, ensure that all root types passed to the serializer have been annotated with 'JsonSerializableAttribute', along with any types that might be serialized polymorphically.
at System.Text.Json.ThrowHelper.ThrowNotSupportedException_NoMetadataForType(Type type, IJsonTypeInfoResolver resolver)
at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)
at System.Text.Json.WriteStackFrame.InitializePolymorphicReEntry(Type runtimeType, JsonSerializerOptions options)
at System.Text.Json.Serialization.JsonConverter.ResolvePolymorphicConverter(Object value, JsonTypeInfo jsonTypeInfo, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1[[System.Object, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TryWrite(Utf8JsonWriter writer, Object& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.Converters.DictionaryOfTKeyTValueConverter`3[[System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].OnWriteResume(Utf8JsonWriter writer, Dictionary`2 value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonDictionaryConverter`3[[System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].OnTryWrite(Utf8JsonWriter writer, Dictionary`2 dictionary, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1[[System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TryWrite(Utf8JsonWriter writer, Dictionary`2& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1[[System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].WriteCore(Utf8JsonWriter writer, Dictionary`2& value, JsonSerializerOptions options, WriteStack& state)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ThrowNotSupportedException(WriteStack& state, Exception innerException)
at System.Text.Json.Serialization.JsonConverter`1[[System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].WriteCore(Utf8JsonWriter writer, Dictionary`2& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1[[System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Serialize(Utf8JsonWriter writer, Dictionary`2& rootValue, Object rootValueBoxed)
at System.Text.Json.JsonSerializer.Serialize[Dictionary`2](Utf8JsonWriter writer, Dictionary`2 value, JsonTypeInfo`1 jsonTypeInfo)
at Microsoft.AspNetCore.Components.WebAssembly.Authentication.InteractiveRequestOptionsSerializerContext.OptionsRecordSerializeHandler(Utf8JsonWriter writer, OptionsRecord value)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.InteractiveRequestOptions.Converter.OptionsRecord, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=9.0.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].Serialize(Utf8JsonWriter writer, OptionsRecord& rootValue, Object rootValueBoxed)
at System.Text.Json.JsonSerializer.Serialize[OptionsRecord](Utf8JsonWriter writer, OptionsRecord value, JsonTypeInfo`1 jsonTypeInfo)
at Microsoft.AspNetCore.Components.WebAssembly.Authentication.InteractiveRequestOptions.Converter.Write(Utf8JsonWriter writer, InteractiveRequestOptions value, JsonSerializerOptions options)
at System.Text.Json.Serialization.JsonConverter`1[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.InteractiveRequestOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=9.0.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].TryWrite(Utf8JsonWriter writer, InteractiveRequestOptions& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.InteractiveRequestOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=9.0.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].WriteCore(Utf8JsonWriter writer, InteractiveRequestOptions& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.InteractiveRequestOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=9.0.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].Serialize(Utf8JsonWriter writer, InteractiveRequestOptions& rootValue, Object rootValueBoxed)
at System.Text.Json.JsonSerializer.WriteString[InteractiveRequestOptions](InteractiveRequestOptions& value, JsonTypeInfo`1 jsonTypeInfo)
at System.Text.Json.JsonSerializer.Serialize[InteractiveRequestOptions](InteractiveRequestOptions value, JsonTypeInfo`1 jsonTypeInfo)
at Microsoft.AspNetCore.Components.WebAssembly.Authentication.InteractiveRequestOptions.ToState()
at Microsoft.AspNetCore.Components.WebAssembly.Authentication.NavigationManagerExtensions.NavigateToLogin(NavigationManager manager, String loginPath, InteractiveRequestOptions request)
at App.Shared.LoginOrRegister.ClickButton() in C:\_development\App\src\App\Shared\LoginOrRegister.razor:line 44
Is there an existing issue for this?
Describe the bug
On adding a
Dictionary<string, string>as a parameter as an AdditionalProperty on anInteractiveRequestOptionsinstance. If you pass that toNavigationManager.NavigateToLoginmethod. It will error.Expected Behavior
The application will redirect to OIDC IdP with additional parameters passed in /authorize request.
Steps To Reproduce
Exceptions (if any)
.NET Version
9.0.201
Anything else?
I see #52291, which appears to be the same, but it is closed as resolved. Am I doing something wrong?
I have also tried the workaround in #45028 and that did not work either.
Note - I am using https://community.auth0.com/t/unable-to-add-parameters-to-login-request-using-blazor-remoteauthenticatorview-component/103763 as my reference implementation.