KEMBAR78
Resource files generates warnings when comment file is enabled · Issue #27911 · dotnet/maui · GitHub
Skip to content

Resource files generates warnings when comment file is enabled #27911

@dotMorten

Description

@dotMorten

Description

Due to a missing attribute, resource files are generating warnings because they don't contain code comments for the classes.

Steps to Reproduce

  1. Create a new .NET MAUI project.
  2. Enable doc comments by adding: <DocumentationFile>$(RootNamespace).xml</DocumentationFile>
  3. Build and notice the generated warnings from the Styles.xaml and Colors.xaml files:
1>E:\Sources.tmp\MauiApp24\MauiApp24\obj\Debug\net9.0-windows10.0.19041.0\win10-x64\intermediatexaml\Microsoft.Maui.Controls.SourceGen\Microsoft.Maui.Controls.SourceGen.CodeBehindGenerator\Resources_Styles_Colors.xaml.sg.cs(17,23,17,45): warning CS1591: Missing XML comment for publicly visible type or member '__TypeCAC680B4A8768504'
1>E:\Sources.tmp\MauiApp24\MauiApp24\obj\Debug\net9.0-windows10.0.19041.0\win10-x64\intermediatexaml\Microsoft.Maui.Controls.SourceGen\Microsoft.Maui.Controls.SourceGen.CodeBehindGenerator\Resources_Styles_Colors.xaml.sg.cs(20,10,20,32): warning CS1591: Missing XML comment for publicly visible type or member '__TypeCAC680B4A8768504.__TypeCAC680B4A8768504()'
1>E:\Sources.tmp\MauiApp24\MauiApp24\obj\Debug\net9.0-windows10.0.19041.0\win10-x64\intermediatexaml\Microsoft.Maui.Controls.SourceGen\Microsoft.Maui.Controls.SourceGen.CodeBehindGenerator\Resources_Styles_Styles.xaml.sg.cs(17,23,17,45): warning CS1591: Missing XML comment for publicly visible type or member '__TypeFD7F2A4CBEE8319A'
1>E:\Sources.tmp\MauiApp24\MauiApp24\obj\Debug\net9.0-windows10.0.19041.0\win10-x64\intermediatexaml\Microsoft.Maui.Controls.SourceGen\Microsoft.Maui.Controls.SourceGen.CodeBehindGenerator\Resources_Styles_Styles.xaml.sg.cs(20,10,20,32): warning CS1591: Missing XML comment for publicly visible type or member '__TypeFD7F2A4CBEE8319A.__TypeFD7F2A4CBEE8319A()'

This happens because the class doesn't have the [GeneratedCode] attribute, but is only applied to the members of the class:

Image

I do wonder if the GenerateCodeAttribute should be removed from the members and placed on the class instead?

Link to public reproduction project repository

No response

Version with bug

9.0.40 SR4

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

No response

Affected platforms

iOS, Android, Windows, macOS

Affected platform versions

No response

Did you find any workaround?

Disable warnings, but that also means not getting warnings from missing comments from non-generated classes. When building class libraries, getting the comments added are important and thus the warning is important.

Relevant log output

Metadata

Metadata

Labels

area-xamlXAML, CSS, Triggers, Behaviorss/triagedIssue has been reviewedt/bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions