-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add boilerplate documentation to generated types #30259
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
base: main
Are you sure you want to change the base?
Add boilerplate documentation to generated types #30259
Conversation
…odeBehindGenerator Fixes dotnet#27911
Hey there @@mlorbetske! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
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 XML documentation boilerplate to code-behind classes and their default constructors generated by CodeBehindGenerator
, preventing CS1591 warnings during documentation builds.
- Inserts
<summary>
comments before the generated class and its XAML attribute. - Adds
<summary>
comments for the optional default constructor. - Supports issue Resource files generates warnings when comment file is enabled #27911 by ensuring documentation warnings are suppressed.
Comments suppressed due to low confidence (1)
src/Controls/src/SourceGen/CodeBehindGenerator.cs:307
- [nitpick] Consider referencing the generated class's CLR type name rather than the file path in the summary (e.g. 'Generated XAML code-behind for MainPage') to improve clarity for consumers.
sb.AppendLine($"\t/// Generated XAML code behind for {projItem.RelativePath}");
@@ -303,6 +303,9 @@ static void GenerateXamlCodeBehind(XamlProjectItem? xamlItem, Compilation compil | |||
|
|||
sb.AppendLine($"namespace {rootClrNamespace}"); | |||
sb.AppendLine("{"); | |||
sb.AppendLine($"\t/// <summary>"); |
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.
Public docs live in XML under /docs/. Please update the relevant docs XML to describe the new boilerplate documentation feature so public documentation aligns with code changes.
Copilot uses AI. Check for mistakes.
@@ -320,6 +323,9 @@ static void GenerateXamlCodeBehind(XamlProjectItem? xamlItem, Compilation compil | |||
//optional default ctor | |||
if (generateDefaultCtor) | |||
{ | |||
sb.AppendLine($"\t\t/// <summary>"); |
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.
Ensure there are automated tests in TestCases.Shared.Tests and TestCases.HostApp that verify CodeBehindGenerator emits the expected <summary>
comments for generated types and constructors.
Copilot uses AI. Check for mistakes.
Description of Change
Add boilerplate documentation to types and constructors produced by CodeBehindGenerator to prevent CS1591 from being raised on these members when documentation build is turned on.
Issues Fixed
Fixes #27911