Skip to content

XML document application should handle void-returning methods #60417

Closed
@captainsafia

Description

@captainsafia

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

XML comments on record constructors produce invalid code.

/// <summary>
/// Represents a client in the system.
/// </summary>
public record Client()

produces:

_cache.Add(new MemberKey(typeof(global::TrainingApi.Shared.Client), MemberType.Method, ".ctor", typeof(global::System.Void), [typeof(global::System.Int32), typeof(global::System.String), typeof(global::System.String), typeof(global::System.String), typeof(global::System.Int32), typeof(global::System.Int32), typeof(global::System.DateTime)]), new XmlComment(@"Represents a client in the system.", null, null, null, null, false, null, null, null));

Which throws:

/Users/captainsafia/git/TrainingApi/net10.0/src/obj/Debug/net10.0/generated/Microsoft.AspNetCore.OpenApi.SourceGenerators/Microsoft.AspNetCore.OpenApi.SourceGenerators.XmlCommentGenerator/OpenApiXmlCommentSupport.generated.cs(184,131): error CS0673: System.Void cannot be used from C# -- use typeof(void) to get the void type object

Expected Behavior

No errors please.

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

Metadata

Metadata

Assignees

Labels

area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesfeature-openapi

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions