Redundant Assignment (Value not used in any execution path)

Resharper is marking a line of code as noted in the subject.

That's fine, in my circumstance it's not neccesarily true, however that not the problem.

When I click on the offending statement I get the Red light bulb which allows me to "Suppress warning "Value assigned is not used in any execution path" by #pragma.

When I select this option it inserts the following:

#pragma warning disable RedundantAssignment
pluginInstance = null;
#pragma warning restore RedundantAssignment

Which results in an invalid number as "RedudantAssignment is not a number.


What is the correct number to put in to disable this warning?

2 comments
Comment actions Permalink

If anyone is interested I found the answer to this in another post

#pragma warning disable 1692
#pragma warning disable RedundantAssignment
pluginInstance = null;
#pragma warning restore RedundantAssignment, 1692

0
Comment actions Permalink

Steve Messer wrote:

If anyone is interested I found the answer to this in another post

#pragma warning disable 1692
#pragma warning disable RedundantAssignment
pluginInstance = null;
#pragma warning restore RedundantAssignment, 1692



Thanks, I've had it before as well (actually only when accidentally
choosing #pragma as an option).

Why wouldn't it be necessarily true in your circumstances? this looks
horrible :)

Best Regards, Wiebe

0

Please sign in to leave a comment.