dotnet / dotnet/roslyn

Automatic exception xml tag when using static class such as ArgumentNullException

Open
#74,776 3 comments 0 reactions 0 assignees View on GitHub
Concept-Continuous Improvement IDE-CodeStyle
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

_This issue has been moved from [a ticket on Developer Community](https://developercommunity.visualstudio.com/t/Automatic-exception-xml-tag-when-using-s/10706235)._

---

```
public void test(string test)
{
if (string.IsNullOrEmpty(test)) { throw new ArgumentNullException(nameof(test)); }
}
```

This generates a summary block comment including the exception node with ArgumentNullException such as :

```
///
///
///
///
///
```

The use of static class doesn't generate the exception node in the xml summary comment.

```
public void test(string test)
{
ArgumentException.ThrowIfNullOrEmpty(test);
}
```

Here is the result:

```
///
///
///
///
```

If possible, make it so that the use of static class helper for exception creates the exception node in xml documentation automatically.

---
### Original Comments

#### Feedback Bot on 7/18/2024, 10:40 PM:

(private comment, text removed)

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by locating Roslyn tests for XML documentation generation and compare an explicit ArgumentNullException throw with ArgumentException.ThrowIfNullOrEmpty. Done means the helper usage generates an exception XML node with the appropriate cref, with existing documentation tests still passing.

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
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.