How to search for Value Assigned is not used in any execution path
Answered
I am working with a large code base (mix of C# and VB.Net projects). The code analysis tool can search for "Value Assigned is not used" but it also identifies false positives like
int i = 0; or Dim i as Integer = 0
I am looking for cases where
MyClass myClass = new MyClass();
myClass = someFunction() // that returns a new instance
I searched for As New in VB.Net code and can see that the code editor correctly flags when the initialization value is unused.
How do I use the built in code analysis feature bypassing the false positives?
Please sign in to leave a comment.
Hello Ramesh,
I beg your pardon for a delay in reply. You can adjust settings for inspection if press Alt-Enter on the value you see the warning for and change settings for the inspection in this exact place, for example, please take a look at the screenshot:
You can find more information in the corresponding Help section: Code inspection: Assignment is not used.