-
Notifications
You must be signed in to change notification settings - Fork 10.3k
[OpenApi] SourceGen error using xml docs for Static methods taking generic parameters. #61864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
also, related workaround: if there is some way I can remove the problematic assembly from openapi doc gen (so I don't have to stop generating xml docs for it), or even better, remove problematic types individually, it would be great to hear. I found the doc pages on this openapi feature to be very good ( https://learn.microsoft.com/en-us/aspnet/core/fundamentals/openapi/openapi-tools?view=aspnetcore-10.0 ), but they don't go over the |
@jasonswearingen See here for how to disable the source generator (about half way down the section): https://github.com/dotnet/core/blob/main/release-notes/10.0/preview/preview2/aspnetcore.md#populate-xml-doc-comments-into-openapi-document |
Thanks, @martincostello. I saw that, but don't think it's exactly what I want. I think it's for disabling the sourcegen entirely? To clarify, I don't want to disable the source generation or use of xml docs, just disable use of certain docs or certain types in the docs. |
Oh I see, sorry I misunderstood. At this point I'd maybe wait until preview.4 which has a bunch of fixes for various issues, and then see if the problem you're having that makes you want to suppress some things persists. |
it's alright, i will just disable the problematic assembly's xml doc for now. I just wanted to bring this to your attention. The OpenApi solution you all are making is so much better than the legacy choices. Thank you. |
@jasonswearingen .NET 10 Preview 4 is out as of an hour ago (see https://devblogs.microsoft.com/dotnet/dotnet-10-preview-4/) which includes this PR I opened a while back (#61145). It contains a bug fix that moves to string-based keys instead of using Can you try it and report back? |
@captainsafia I'm sorry I was required to move back to net9 due to azure compatibility issues. you all should include this in your test cases, it is very straight forward (see the first post in this issue for a snippet) |
We included test cases as part of the Preview 4. Closing this as resolved for now. |
Is there an existing issue for this?
Describe the bug
it seems that a static class with Generic methods causes errors with the OpenApi sourcegen.
If I change the library's
.csproj
to include:<GenerateDocumentationFile>false</GenerateDocumentationFile>
the error disappears.a library referenced by my aspnetcore api has:
causes the following line to be generated in
.Generated\Microsoft.AspNetCore.OpenApi.SourceGenerators\Microsoft.AspNetCore.OpenApi.SourceGenerators.XmlCommentGenerator\OpenApiXmlCommentSupport.generated.cs
which triggers the following error in build output:
Expected Behavior
see above
Steps To Reproduce
see above
Exceptions (if any)
see above
.NET Version
10.0.0-preview.3.25172.1
Anything else?
Microsoft.AspNetCore.OpenApi v10.0.0-preview.3.25172.1
The text was updated successfully, but these errors were encountered: