Skip to content
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

WindowsAppSDK-VersionInfo.cs and MddBootstrapAutoInitializer.cs cause warnings in analyzers #2032

Closed
Balkoth opened this issue Jan 27, 2022 · 18 comments
Assignees
Labels
area-DeveloperTools Issues related to authoring (source and IDL), debugging, HotReload, LiveVisualTree, VS integration bug Something isn't working

Comments

@Balkoth
Copy link

Balkoth commented Jan 27, 2022

Describe the bug

Setting <GenerateDocumentationFile>True</GenerateDocumentationFile> in the project causes the following warnings to appear:

image

Another issue is reported here:
DotNetAnalyzers/StyleCopAnalyzers/#3441

Steps to reproduce the bug

1.) Create a new WinUI 3 app with the template: Blank App, Packaged (WinUI 3 in Desktop)
2.) Enable documentation generation
3.) Build the app

Expected behavior

Warnings from nuget packages should not appear in any project that uses them.

Screenshots

No response

NuGet package version

1.0.0

Packaging type

Packaged (MSIX), Unpackaged

Windows version

Windows 10 version 2004 (19041, May 2020 Update)

IDE

Visual Studio 2022

Additional context

No response

@btueffers btueffers added the area-DeveloperTools Issues related to authoring (source and IDL), debugging, HotReload, LiveVisualTree, VS integration label Jan 27, 2022
@BenJKuhn BenJKuhn added the bug Something isn't working label Feb 10, 2022
@Balkoth
Copy link
Author

Balkoth commented Mar 22, 2022

This bug still exists in v1.0.1

@Donsroom
Copy link

In version 1.1.0-preview2 I don't get warnings but I do get several messages. I think this is caused by me having many of my VS code style settings set to "Suggestion" instead of "Refactoring Only". Is there a way to exclude this file from being checked against the VS code style settings (ie. Tools | options | Text Editor | C# | Code Style)

2022-04-19_210621

@Balkoth
Copy link
Author

Balkoth commented Jun 8, 2022

Still not fixed in v1.1.0

@mattleibow
Copy link

Should these classes be internal?

@evelynwu-msft
Copy link
Contributor

@DrusTheAxe It appears that there are additional StyleCop warnings that aren't covered by #2533; is that expected?

@Balkoth
Copy link
Author

Balkoth commented Jul 8, 2022

Still not fixed in v1.1.2

@DrusTheAxe
Copy link
Member

I'll be looking at it next week

@Balkoth
Copy link
Author

Balkoth commented Jul 22, 2022

Still not fixed in v1.1.3

@DrusTheAxe
Copy link
Member

I did some digging...

Workaround here => dotnet/roslyn#53729 (comment)

Official word is it's a feature => dotnet/roslyn#53729 (comment)

Closing because this behavior is "By Design" and I don't really see us changing it here. The compiler itself has very little understanding of generated code in terms of how it handles diagnostics. That is true for the types of files that we register as generated as well as the behavior we tweak for those files (think it's pretty much just nullable diagnostics at this point).

The solution here is to either generate the correct code or to disable the warning in editorconfig for that pattern of files (as you showed in the sample above)

Another discussion with the full menu of options => https://stackoverflow.com/questions/7982525/visual-studio-disabling-missing-xml-comment-warning

To summarise, the ways around the warning would be to:

  • Suppress the warning by changing the project Properties > Build > Errors and warnings > Suppress warnings by entering 1591
  • Add the XML documentation tags (GhostDoc can be quite handy for that)
  • Suppress the warning via compiler options
    Uncheck the "XML documentation file" checkbox in project Properties > Build > Output
  • Add #pragma warning disable 1591 at the top of the respective file and #pragma warning restore 1591 at the bottom

and a little later in that thread a C# specific answer which looks most promising

You can also modify your project's .csproj file to include a 1591 tag inside of the first . Originally from Alexandru Bucur's Article Here

... 1591 ...

@DefaultRyan is it possible to declare that <PropertyGroup> in one of our nuget's .props to address this?

@Balkoth
Copy link
Author

Balkoth commented Jul 23, 2022

How about you just document the stuff...

@DrusTheAxe
Copy link
Member

DrusTheAxe commented Jul 23, 2022

We do e.g. https://docs.microsoft.com/en-us/windows/apps/api-reference/cs-bootstrapper-apis/cs-bootstrapper-apis-constants.

This isn't about documenting our stuff, but a matter of how, or more precisely, where.

Is it just the warning noise that's an issue?

Does having doccomments in source bring any additional value (or issues)?

Just for files like MddBootstrapAutoInitialize.cs that are compiled into your binaries or others as well e.g. WinAPI APIs available to C# developers via C#/WinRT like `Microsoft.Windows.ApplicationModel.DynamicDependency'?

@Balkoth
Copy link
Author

Balkoth commented Jul 23, 2022

Imho it is noise. Noise that should not be there as i as developer have no control over those files. I should not have to do anything to work around those warnings.

@DrusTheAxe
Copy link
Member

Imho it is noise.

Gotcha. Thanks for the input.

I should not have to do anything to work around those warnings.

No disagreement, just trying to figure out the needs and best ways to squash the issue. I have a simple fix for the surface issue and we're discussing if a bigger change is warranted for the larger picture. I've teed up a patch for main and will bring it for 1.1-servicing consideration for our next servicing update.

@Balkoth Balkoth closed this as completed Oct 17, 2022
@MartyIX
Copy link

MartyIX commented Jan 21, 2023

Developing .NET MAUI app with .NET 7.0, I can still see some warnings from WindowsAppSDK-VersionInfo.cs from time to time. Is it just me or can you see it too?

@symbiogenesis
Copy link

symbiogenesis commented Jan 21, 2023

I can see it too, also on MAUI.

This file really needs to start with:

/// <auto-generated>

Also, I'm not sure, but I suspect that it is related to setting the property GenerateDocumentationFile to true, and could likely be fixed by setting it to false. Setting it to true probably isn't really necessary unless you are building a library for public consumption.

But this is clearly a bug.

@DrusTheAxe
Copy link
Member

WindowsAppSDK-VersionInfo.cs was missed in the pass previously fixing this. in other files.

That's generated out of another repo so I'll cook a fix over there. Thanks for reporting this.

@symbiogenesis
Copy link

symbiogenesis commented Jan 14, 2024

I'm still seeing this. Maybe because <auto-generated> isn't on the very first line?

Tagging it with the GeneratedCodeAttribute may also fix it

@MartyIX
Copy link

MartyIX commented Jan 14, 2024

Not fixed for me as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-DeveloperTools Issues related to authoring (source and IDL), debugging, HotReload, LiveVisualTree, VS integration bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants