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!
Please sign in to leave a comment.
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!"
Thanks! For the possible benefit of others (or me if needed after an upgrade <g>) here are a couple notes.
C:\Program Files (x86)\JetBrains\ReSharper\v5.1\Bin\ExternalAnnotations\System\System.xml
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.
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!"
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.