You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to resolve this:
Unhandled Exception: System.InvalidOperationException: Reflection-based serialization has been disabled for this application. Either use the source generator APIs or explicitly configure the 'JsonSerializerOptions.TypeInfoResolver' property.
at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_JsonSerializerIsReflectionDisabled() + 0x30
at System.Text.Json.JsonSerializerOptions.ConfigureForJsonSerializer() + 0x44
at Microsoft.Extensions.Configuration.AzureAppConfiguration.JsonKeyValueAdapter.ProcessKeyValue(ConfigurationSetting, Logger, CancellationToken) + 0xac
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.d__38.MoveNext() + 0x138
--- End of stack trace from previous location ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x24
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x90
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x68
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.d__29.MoveNext() + 0x1b4
--- End of stack trace from previous location ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x24
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x90
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x68
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.d__32.MoveNext() + 0x4cc
--- End of stack trace from previous location ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x24
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x90
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x68
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.d__31.MoveNext() + 0xe0
--- End of stack trace from previous location ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x24
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x90
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x68
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.d__30.MoveNext() + 0x1b8
--- End of stack trace from previous location ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x24
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x90
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x68
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.Load() + 0x24c
at Microsoft.Extensions.Configuration.ConfigurationManager.AddSource(IConfigurationSource) + 0x44
The text was updated successfully, but these errors were encountered:
Hi @scorpionfly7, based on the exception I was able to find this documentation about the issue. The provider uses reflection-based serialization for json values, so it seems like this issue is expected for native AOT apps. Do you know if it's enabled for your application? If not, could you tell me more about the type of application you have and the version of .NET it uses?
@amerjusupovic We don’t want to enable this feature for whole app. We have .net core application, . Net 8, using last version of app configuration SDK. Is there way, which not requires turn on of that option?
@scorpionfly7 Currently, using key-values with application/json in the content type won't work while reflection-based serialization is disabled. We do intend to allow native AOT apps to use all of the features of App Configuration though, so we're looking into a solution. Thank you for bringing up this issue.
How to resolve this:
Unhandled Exception: System.InvalidOperationException: Reflection-based serialization has been disabled for this application. Either use the source generator APIs or explicitly configure the 'JsonSerializerOptions.TypeInfoResolver' property.
at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_JsonSerializerIsReflectionDisabled() + 0x30
at System.Text.Json.JsonSerializerOptions.ConfigureForJsonSerializer() + 0x44
at Microsoft.Extensions.Configuration.AzureAppConfiguration.JsonKeyValueAdapter.ProcessKeyValue(ConfigurationSetting, Logger, CancellationToken) + 0xac
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.d__38.MoveNext() + 0x138
--- End of stack trace from previous location ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x24
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x90
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x68
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.d__29.MoveNext() + 0x1b4
--- End of stack trace from previous location ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x24
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x90
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x68
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.d__32.MoveNext() + 0x4cc
--- End of stack trace from previous location ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x24
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x90
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x68
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.d__31.MoveNext() + 0xe0
--- End of stack trace from previous location ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x24
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x90
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x68
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.d__30.MoveNext() + 0x1b8
--- End of stack trace from previous location ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x24
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x90
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x68
at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.Load() + 0x24c
at Microsoft.Extensions.Configuration.ConfigurationManager.AddSource(IConfigurationSource) + 0x44
The text was updated successfully, but these errors were encountered: