dotnet / dotnet/roslyn

Warn when using `returns` XML doc comment for void methods

Open
#84,208 1 comment 0 reactions 0 assignees View on GitHub
Area-Compilers XML Documentation
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

Violation example:

https://github.com/dotnet/roslyn/blob/ab4cbf6de14bebf0b90771aaa1de52d780984e58/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs#L1232-L1236

(which in itself is appreciated to get fixed)

I don't think `` XML element make sense for a method that doesn't return anything.

This could be done either in the compiler as part of warning waves (if that's still a thing in use?) or could it be an analyzer.

Contributor guide

Open the contributing guide

Research direction

Start by reading src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs around lines 1232-1236 and compare the compiler warning-wave and analyzer options raised in the issue. Determine which implementation path is appropriate and identify the relevant diagnostic tests; done means void methods using a XML comment produce the intended warning without affecting methods that return a value.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.