Skip to content

OpenAPI Throws System.ArgumentNullException Inside Docker #56309

Closed
@NixFey

Description

@NixFey

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When spinning up a new Web project, then building and running in Docker, an error is thrown when attempting to go to the OpenAPI endpoint. This bug does not occur when running locally outside of a container.

Expected Behavior

The OpenAPI document is returned, like it is when running locally in Debug/Run mode.

Steps To Reproduce

https://github.com/evanlihou/Net9OpenApiBugTest

Exceptions (if any)

fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HN4FUDA16P3M", Request id "0HN4FUDA16P3M:00000001": An unhandled exception was thrown by the application.
      System.ArgumentNullException: Value cannot be null. (Parameter 'type')
         at System.Text.Json.ThrowHelper.ThrowArgumentNullException(String parameterName)
         at System.Text.Json.JsonSerializerOptions.GetTypeInfo(Type type)
         at JsonSchemaMapper.JsonSchemaMapper.MapJsonSchemaCore(GenerationState& state, JsonTypeInfo typeInfo, Type parentType, JsonPropertyInfo parentPropertyInfo, ParameterInfo parentParameterInfo, String description, Boolean isNullableReferenceType, Boolean isNullableOfTElement, JsonConverter customConverter, Nullable`1 customNumberHandling, Boolean hasDefaultValue, JsonNode defaultValue, Type parentPolymorphicType, Nullable`1 typeDiscriminator)
         at JsonSchemaMapper.JsonSchemaMapper.GetJsonSchema(JsonSerializerOptions options, Type type, JsonSchemaMapperConfiguration configuration)
         at Microsoft.AspNetCore.OpenApi.OpenApiComponentService.CreateSchema(ValueTuple`2 key)
         at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
         at Microsoft.AspNetCore.OpenApi.OpenApiComponentService.GetOrCreateSchema(Type type, ApiParameterDescription parameterDescription)
         at Microsoft.AspNetCore.OpenApi.OpenApiDocumentService.GetResponse(ApiDescription apiDescription, Int32 statusCode, ApiResponseType apiResponseType)
         at Microsoft.AspNetCore.OpenApi.OpenApiDocumentService.GetResponses(ApiDescription description)
         at Microsoft.AspNetCore.OpenApi.OpenApiDocumentService.GetOperation(ApiDescription description, HashSet`1 capturedTags)
         at Microsoft.AspNetCore.OpenApi.OpenApiDocumentService.GetOperations(IGrouping`2 descriptions, HashSet`1 capturedTags)
         at Microsoft.AspNetCore.OpenApi.OpenApiDocumentService.GetOpenApiPaths(HashSet`1 capturedTags)
         at Microsoft.AspNetCore.OpenApi.OpenApiDocumentService.GetOpenApiDocumentAsync(CancellationToken cancellationToken)
         at Microsoft.AspNetCore.Builder.OpenApiEndpointRouteBuilderExtensions.<>c__DisplayClass0_0.<<MapOpenApi>b__0>d.MoveNext()
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Http.Generated.<GeneratedRouteBuilderExtensions_g>F56B68D2B55B5B7B373BA2E4796D897848BC0F04A969B1AF6260183E8B9E0BAF2__GeneratedRouteBuilderExtensionsCore.<>c__DisplayClass2_0.<<MapGet0>g__RequestHandler|5>d.MoveNext()
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

.NET Version

9.0.0-preview.6.24307.2

Anything else?

Using latest stable version of JetBrains Rider on macOS

Using nightly 9.0-preview Docker images as base

dotnet --info inside of container

Host:
  Version:      9.0.0-preview.6.24307.2
  Architecture: arm64
  Commit:       static
  RID:          linux-arm64

.NET SDKs installed:
  No SDKs were found.

.NET runtimes installed:
  Microsoft.AspNetCore.App 9.0.0-preview.6.24309.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 9.0.0-preview.6.24307.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.feature-openapiold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions