You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also repro'd when installing Version: 8.0.0 explicitly.
Describe the bug
Dead-code analysis shows false-positives.
In the attached example (& screenshot below) the methods CreateSomething and KreateSomething are identical, and can return null.
However, the analyser objects to the null check for the return value of one method, but not the other.
Steps To Reproduce
Load the attached solution into VS2022 and compile.
[A weird quirk is that the analyser does not show this false positive in the duplicate code in Program.cs, which uses the new console template. Is such code treated differently?]
The text was updated successfully, but these errors were encountered:
Analyzer
Diagnostic ID: CA1508:
Avoid dead conditional code
Analyzer source
SDK: Built-in CA analyzers in .NET 5 SDK or later
Version: [SDK 8.0.400]
Also repro'd when installing Version: 8.0.0 explicitly.
Describe the bug
Dead-code analysis shows false-positives.
In the attached example (& screenshot below) the methods
CreateSomething
andKreateSomething
are identical, and can return null.However, the analyser objects to the null check for the return value of one method, but not the other.
Steps To Reproduce
Load the attached solution into VS2022 and compile.
Expected behavior
No CA1508 warnings should be raised
Actual behavior
False positive warning is raised.
ConsoleApp1.zip
[A weird quirk is that the analyser does not show this false positive in the duplicate code in Program.cs, which uses the new console template. Is such code treated differently?]
The text was updated successfully, but these errors were encountered: