Hi there!

Hi there!
My name is Michael Ivanov and i'm a Senior SDE/Software architect.
My CV - here. You can find articles and other blog posts on the main page. I also develop some free and commercial software - complete list is here.

Wednesday, May 5, 2010

just-in-mind: resharper doesn't look into false preprocessor directives

Suddenly noticed resharper doesn't look into preprocessor directives if they are false. For example, it counts such code as good:

var debugVariable = 0;
Console.WriteLine("This use the variable in output, " + debugVariable);
Console.WriteLine("And this is not");

Now, switch to "Release" configuration and add some preprocessor directives, to get a code like this:

var debugVariable = 0;
#if DEBUG
Console.WriteLine("This use the variable in output, " + debugVariable);
#else
Console.WriteLine("And this is not");
#endif

Resharper doesn't like it and it shows that variable debugVariable is never used.

No comments: