Ignore HeuristicUnreachableCode After Debug.Assert?

I like to keep my ReSharper Status Indicator Green, and I'm also learning the value of value of having Debug.Assert() statements many places, especially where errors "cannot happen."  :D

To satisfy both these needs I have many methods that end similar to this snippet.

   1:  
   2:                 default :
   3:                     Debug.Assert(false, "type/fieldNum not processed");
   4: // ReSharper disable HeuristicUnreachableCode
   5:                     return null;
   6: // ReSharper restore HeuristicUnreachableCode
   7:             }
   8:         }
   9:  
  10:  


Is there some way to tell R# that Debug.Assert() doesn't "block" code after it?  Thanks!

5 comments
Comment actions Permalink

Hello Mark,

In order to avoid this warning you should close all instances of Visual Studio
and remove the following text:

\Bin\ExternalAnnotations\System\System.xml
file. Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

where



0
Comment actions Permalink

Thanks!  For the possible benefit of others (or me if needed after an upgrade <g>) here are a couple notes.

  • On my computer this was the full path.
    C:\Program Files (x86)\JetBrains\ReSharper\v5.1\Bin\ExternalAnnotations\System\System.xml

  • Renaming the file to "zzzSystem.xml" was not sufficient (Win7).  I had to copy it to another folder (for backup) and delete it.
0
Comment actions Permalink

Is there some way to do this for preprocessor conditions too?
We used #if !DEBUG and somebody removed code wich was called inside such a region which produced a compile error in release mode.

0
Comment actions Permalink

Hello Sven,

No, I'm afraid there's no way to do the same for conditional preprocessor
directives. Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

Is there some way to do this for preprocessor conditions too?

We used #if !DEBUG and somebody removed code wich was called inside
such a region which produced a compile error in release mode.

---
Original message URL:
http://devnet.jetbrains.net/message/5276824#5276824



0
Comment actions Permalink

Hello,

is it possible to overwrite the annotations with a project/solution local .xml file instead of deleting the file from the installation folder (in R# 10)? We want to avoid such things when setting up a new developer/build machine or updating to a new R# version.

 

0

Please sign in to leave a comment.