As I have mentioned before, I very much enjoy working with ReSharper by JetBrains. We recently purchased version 1.5 and I really like it. It does have some interesting quirks when dealing with compilation directives. It seems that ReSharper, in providing its own custom Intellisense, continues to evaluate compilation blocks that are excluded from the current build. For example, ReSharper gets confused when you have something like this:
#if ( DEBUG )
public class DevstoneTestControlBase : UserControl {
#else
public abstract class DevstoneTestControlBase : UserControl {
#endif
// actual class implementation here...
}
I periodically decorate my classes this way (especially control-based, UI components) so that in a design, debug environment I can use a designer (which relies on publically creatable classes in order to render the UI) but to mark the classes as abstract when compiled in a 'Release' form so that the proper behaviors are enforced.
When you do this, however, ReSharper throws fits because it cannot resolve protected or public members in the derived class back to the base class. However, with just a bit of cleverness you can overcome this ReSharper shortcoming and still have your cake and eat it too.
#if ( !DEBUG )
abstract
#endif
public class DevstoneTestControlBase : UserControl {
// class implementation here...
}
This way, the 'Release-only' modifiers are moved out of the declaration (but still valid when evaluated) and only class declaration exists. While there are still other nuances with how ReSharper evaluates compilation directives (having different using clauses conditionally, or declaring variables within them, for example), I'm glad to be able to overcome this one.