Skip to content

bug: ArgumentNullException in OperationResponseProcessor #5321

@oe-rene-kortmann

Description

@oe-rene-kortmann

Describe the bug

The returnTypeAttributes result can be null if MethodInfo is null which raise a ArgumentNullException in ToContextutalType.

var returnTypeAttributes = context.MethodInfo?.ReturnParameter?.GetCustomAttributes(false).OfType<Attribute>();
var contextualReturnType = returnType.ToContextualType(returnTypeAttributes);

Version of NSwag toolchain, computer and .NET runtime used

Nswag: 14.2.0 but also tested with 14.6.3
.NET: 6.0

To Reproduce

Code example:

NswagArgumentNullProblem.zip

Expected behavior

Swagger is rendered correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions