-
Notifications
You must be signed in to change notification settings - Fork 468
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
CA2200: Rethrow to preserve stack details - should not warn when throwing different exception #4280
Comments
A similar case is being tested: Line 56 in 76374e7
@Evangelink Was this fixed in your re-write of the analyzer? or it should have been working from before the rewrite? |
@buyaa-n Can you test with the latest package from https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet6&package=Microsoft.CodeAnalysis.NetAnalyzers&protocolType=NuGet&version=6.0.0-preview1.20501.5&view=overview? I suspect @Evangelink's recent fix in master would have fixed this. We should consider backporting the change to release/dotnet5-rc2 branch if that is the case. |
Yep, it is the same case, looks already fixed
Yep i used RC2 branch, not master, agree we should port it to RC2 |
Hm, i still see the warning with that version |
@buyaa-n Interesting! Let me add a test and debug it. |
I didn't consider this case, honestly that's the first time I am seeing this pattern :) @Youssef1313 has already filed a PR |
Analyzer
Diagnostic ID: CA2200:
Rethrow to preserve stack details
Analyzer source
SDK: Built-in CA analyzers in .NET 5 SDK or later
Version: SDK 5.0.100-preview.8
Describe the bug
The caught exception
ex
is only thrown when it is mapped into a different exception by theMapSendException(...)
method. The analyzer should not warn in this case, further I would assume CA2200 should not warn when the catch block is throwing a different exception (mappedEx
) than the catched exception (ex
)The exact warning found here, related to dotnet/runtime#42957 (comment)
Expected behavior
Should not warn in above case
Actual behavior
Warning
The text was updated successfully, but these errors were encountered: