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

Overridden methods causes warnings due to missing documentation #41

Open
VMelnalksnis opened this issue Jun 27, 2023 · 1 comment
Open

Comments

@VMelnalksnis
Copy link

Description
When OnPropertyChanged is overridden in a derived class it does not have XML comments, and so it causes a CS1591 warning.

To Reproduce
Set <GenerateDocumentationFile>true</GenerateDocumentationFile> in csproj, example with derived class from README - https://github.com/canton7/PropertyChanged.SourceGenerator#automatic-dependencies.

Version Info

  • PropertyChanged.SourceGenerator version: 1.0.8
  • Roslyn Version: Compiler version: '4.6.0-3.23259.8 (c3cc1d0c)'. Language version: 11.0.

Additional Info
In this case just adding /// <inheritdoc /> would be enough, and users of the library would be able to add the documentation if needed. I'm not sure if there are any other places where public/protected members could be generated. Another possibility might be to just add #pragma warning disable CS1591 in all generated files.

@VMelnalksnis
Copy link
Author

I checked the source code, and I guess what's missing is an else clause for this if statement https://github.com/canton7/PropertyChanged.SourceGenerator/blob/94690bbaa71d8e7c6c1bc9e7e3b3f63b4b15dbc6/src/PropertyChanged.SourceGenerator/Generator.cs#L130C11-L130C11.
Something like

if (interfaceAnalysis.RaiseMethodType != RaisePropertyChangedMethodType.Override)
{
    // existing logic
}
else
{
    this.writer.WriteLine($"/// <inheritdoc />");
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant