Skip to content

[Bug]: Error starting SwaggerUI, http 500 #2905

@hancpavel

Description

@hancpavel

Describe the bug

When starting Swagger ui on latest 6.6.1 version, getting error:
Message: JsonTypeInfo metadata for type 'System.Boolean' was not provided by TypeInfoResolver of type 'Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIOptionsJsonContext'. 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: $.AdditionalItems.
Full exception: System.NotSupportedException: JsonTypeInfo metadata for type 'System.Boolean' was not provided by TypeInfoResolver of type 'Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIOptionsJsonContext'. 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: $.AdditionalItems.
---> System.NotSupportedException: JsonTypeInfo metadata for type 'System.Boolean' was not provided by TypeInfoResolver of type 'Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIOptionsJsonContext'. 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, Nullable1 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.JsonConverter1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.Converters.DictionaryOfTKeyTValueConverter3.OnWriteResume(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter1.TryWriteDataExtensionProperty(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.GetMemberAndWriteJsonExtensionData(Object obj, WriteStack& state, Utf8JsonWriter writer) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
--- End of inner exception stack trace ---

Expected behavior

To work well as on 6.5.0 version :)

Actual behavior

No response

Steps to reproduce

Code is the same, when reverting nuGet module back to 6.5.0 everything works well.

Exception(s) (if any)

No response

Swashbuckle.AspNetCore version

6.6.1

.NET Version

6.0.29

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions