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

RCS1140 throws an ArgumentNullException in try/catch when exception is not used #1553

Closed
merlinschumacher opened this issue Oct 8, 2024 · 0 comments · Fixed by #1554
Closed

Comments

@merlinschumacher
Copy link

Rosylnator Analyzers 4.12.7:

Steps to Reproduce:
Create a custom exception, use the custom exception in a try/catch, where you don't use the exception.

Here is an example project:
https://github.com/merlinschumacher/Roslyn-RCS1140-Issue

With 4.12.6 the issue isn't present.

Actual Behavior:
This triggers an argument null exception. Independent of the presence of an XML comment for the exception:

            try
            {
                Method2();
            }
            catch
            {
                throw new MyCustomException("MyCustomException");
            }

This works (passing the caught exception is not necessary):

            try
            {
                Method2();
            }
            catch (Exception ex)
            {
                throw new MyCustomException("MyCustomException");
            }

Expected Behavior:
To create an analyzer message notifying me of the possibly missing XML comment.

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

Successfully merging a pull request may close this issue.

2 participants