dotnet / dotnet/roslyn

ArgumentNullException.ThrowIfNull prevents automatic exception documentation

Open
#77,281 1 comment 1 reaction 0 assignees View on GitHub
Area-IDE
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/ArgumentNullExceptionThrowIfNull-preven/10849843)._

---
[severity:It bothers me. A fix would be nice]
When using `ArgumentNullException.ThrowIfNull` instead of a normal throw statement, writing `///` no longer automatically documents `ArgumentNullException` as a possible exception thrown by the method:

![image.png](https://aka.ms/dc/image?name=Bd13073a223594140b48f4d81bc3e5e46638751215059522899_20250214-101825-image.png&tid=d13073a223594140b48f4d81bc3e5e46638751215059522899)

-->

![image.png](https://aka.ms/dc/image?name=B89cabd01ca8942baa1eb3647817665a5638751215512898594_20250214-101910-image.png&tid=89cabd01ca8942baa1eb3647817665a5638751215512898594)

---
### Original Comments

#### Feedback Bot on 2/16/2025, 08:15 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Contributor guide

Open the contributing guide

Research direction

The issue provides no Roslyn file, test, or entry point to follow. Start by reproducing the XML documentation completion behavior in Visual Studio with a method using ArgumentNullException.ThrowIfNull and compare it with an explicit throw statement. Done means the completion experience documents ArgumentNullException consistently for both forms, with regression coverage added in the relevant Roslyn tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.