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

Use ArgumentNullException.ThrowIfNull helper method #8503

Merged
merged 2 commits into from
Oct 7, 2022

Conversation

Bond-009
Copy link
Member

@Bond-009 Bond-009 commented Oct 6, 2022

Did a simple search/replace on the whole repo (except the RSSDP project) This reduces LOC and should improve performance (methods containing a throw statement don't get inlined)

if \((\w+) == null\)
\s+\{
\s+throw new ArgumentNullException\(.*\);
\s+\}
ArgumentNullException.ThrowIfNull($1);

@crobibero
Copy link
Member

The second parameter isn't required -> ArgumentNullException.ThrowIfNull(request);

Did a simple search/replace on the whole repo (except the RSSDP project)
This reduces LOC and should improve performance (methods containing a throw statement don't get inlined)

```
if \((\w+) == null\)
\s+\{
\s+throw new ArgumentNullException\((.*)\);
\s+\}
```

```
ArgumentNullException.ThrowIfNull($1);
```
@Bond-009
Copy link
Member Author

Bond-009 commented Oct 6, 2022

Cool, TIL CallerArgumentExpressionAttribute exists (since core 3.0 😲 )

@cvium cvium merged commit 719e5ea into jellyfin:master Oct 7, 2022
@Bond-009 Bond-009 deleted the ThrowIfNull branch December 7, 2022 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants