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
I use this code snippet to disable syntax highlighting for json responses, as I create really large responses and the syntax highlighting does not complete/hangs up with 6.5:
System.NotSupportedException: Metadata for type 'System.Boolean' was not provided to the serializer. The serializer method used does not support reflection-based creation of serialization-related type metadata. If using source generation, ensure that all root types passed to the serializer have been indicated with 'JsonSerializableAttribute', along with any types that might be serialized polymorphically. The unsupported member type is located on type 'System.Object'. Path: $.AdditionalItems.
---> System.NotSupportedException: Metadata for type 'System.Boolean' was not provided to the serializer. The serializer method used does not support reflection-based creation of serialization-related type metadata. If using source generation, ensure that all root types passed to the serializer have been indicated with 'JsonSerializableAttribute', along with any types that might be serialized polymorphically.
at System.Text.Json.ThrowHelper.ThrowNotSupportedException_NoMetadataForType(Type type)
at System.Text.Json.JsonSerializerOptions.GetClassFromContextOrCreate(Type type)
at System.Text.Json.JsonSerializerOptions.GetOrAddClass(Type type)
at System.Text.Json.WriteStackFrame.InitializeReEntry(Type type, JsonSerializerOptions options)
at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.Converters.DictionaryOfTKeyTValueConverter`3.OnWriteResume(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1.TryWriteDataExtensionProperty(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.GetMemberAndWriteJsonExtensionData(Object obj, WriteStack& state, Utf8JsonWriter writer)
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.Converters.JsonMetadataServicesConverter`1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ThrowNotSupportedException(WriteStack& state, NotSupportedException ex)
at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.JsonSerializer.WriteUsingSerializer[TValue](Utf8JsonWriter writer, TValue& value, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.WriteUsingGeneratedSerializer[TValue](Utf8JsonWriter writer, TValue& value, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.WriteStringUsingGeneratedSerializer[TValue](TValue& value, JsonTypeInfo jsonTypeInfo)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.GetIndexArguments()
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.RespondWithIndexHtml(HttpResponse response)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
As the error mentions the path "AdditionalItems", I was pointed to the config switch. Removing the line makes the service work again.
I include the packages "Swashbuckle.AspNetCore", "Swashbuckle.AspNetCore.Annotations" and "Swashbuckle.AspNetCore.Newtonsoft", the service also uses "Microsoft.AspNetCore.Mvc.NewtonsoftJson". But the error message says that "System.Text.Json" was used here.
Expected behavior
No response
Actual behavior
No response
Steps to reproduce
No response
Exception(s) (if any)
No response
Swashbuckle.AspNetCore version
No response
.NET Version
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
I use this code snippet to disable syntax highlighting for json responses, as I create really large responses and the syntax highlighting does not complete/hangs up with 6.5:
Source for this: https://stackoverflow.com/questions/64053444/setting-syntaxhighlight-property-for-swagger-ui-with-swashbuckle-aspnetcore (and https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/)
After updating from 6.5.0 to 6.6.1, the url "https://localhost:1235/swagger/index.html" shows this error:
As the error mentions the path "AdditionalItems", I was pointed to the config switch. Removing the line makes the service work again.
I include the packages "Swashbuckle.AspNetCore", "Swashbuckle.AspNetCore.Annotations" and "Swashbuckle.AspNetCore.Newtonsoft", the service also uses "Microsoft.AspNetCore.Mvc.NewtonsoftJson". But the error message says that "System.Text.Json" was used here.
Expected behavior
No response
Actual behavior
No response
Steps to reproduce
No response
Exception(s) (if any)
No response
Swashbuckle.AspNetCore version
No response
.NET Version
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: