-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Suppress CS1591 warnings in ComInterfaceGenerator generated code #120104
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
Suppress CS1591 warnings in ComInterfaceGenerator generated code #120104
Conversation
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/Compiles.cs
Show resolved
Hide resolved
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/Compiles.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds CS1591 warning suppression to the ComInterfaceGenerator to prevent "missing XML documentation" warnings in generated code when GenerateDocumentationFile is enabled in MSBuild. The generated code should not produce documentation warnings since it's automatically generated and inherits documentation from the original interface.
Key changes:
- Added CS1591 to the pragma warning disable statement in generated code
- Updated the comment to reflect that missing XML documentation warnings are also suppressed
- Added a test case with documented COM interfaces to validate the suppression works correctly
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| ComInterfaceGenerator.cs | Added CS1591 to pragma warning disable statement and updated comment |
| CodeSnippets.cs | Added DocumentedComInterface test case with XML documentation |
| Compiles.cs | Included the new documented interface test in the compilation test suite |
|
Source change looks good, but the test still passes with the change reverted, so it's not validating the expected behavior. We probably need to update the compilation to enable the diagnostic. |
|
@copilot see remarks above. please address |
Co-authored-by: danmoseley <6385855+danmoseley@users.noreply.github.com>
You're absolutely right. I've fixed the test to properly validate CS1591 suppression by:
The test now actually validates the behavior rather than just compiling the code. Changes in commit 8c7e0c9. |
|
Tagging subscribers to this area: @dotnet/interop-contrib |
src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/Compiles.cs
Show resolved
Hide resolved
src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/Compiles.cs
Outdated
Show resolved
Hide resolved
…ce snippet Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
|
@jtschuster can you take another look when you have a chance? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
|
/ba-g blazor failure |
Changes Made
Modified ComInterfaceGenerator.cs: Added CS1591 to the pragma warning disable statement on line 207 and updated the comment to include "missing XML documentation" warnings.
Enhanced test validation: Following @jkoritzinsky's feedback:
DocumentationMode.Diagnoseto parse options in the test to properly enable CS1591 validationDocumentedComInterfacesnippet fromCodeSnippets.cssince we need a custom test for proper validationDocumentedComInterfacefromComInterfaceSnippetsToCompile()Microsoft.CodeAnalysis.CSharpusing statement forDocumentationModeandCSharpParseOptionsTest validation confirmed:
Verification Results
ValidateComInterfaceSnippetstests pass + dedicated CS1591 suppression test passesDocumentationMode.Diagnose, test now properly enables CS1591 validationGenerateDocumentationFile=TrueThe test now properly validates CS1591 suppression with the correct documentation mode enabled, addressing all feedback.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.