New rule: DoNotWrapPublicInterfaceIntoConditionalBlock

Apr 10, 2011 at 6:32 AM

This rule may be more FxCop-ish.

Do not wrap parts of class public interface into #if DEBUG block.

Example:

public class Item
{
#if DEBUG
    int GetLength();
#endif
}
This will generate different code for debug and retail builds and may introduce tricky issues.

Coordinator
Apr 12, 2011 at 4:34 PM

Lets see what everyone else thinks. Maybe this is a common pattern that people do actually need. Thoughts everyone please?

Developer
Apr 13, 2011 at 8:40 AM

In my opinion, the rule is

  • fuzzy (there could be any preprocessor directive)
  • uncommon (never saw anything like that)
  • doesn't relate to style

Best regards,
Oleg Shuruev

Apr 14, 2011 at 1:31 AM

I don't think this has anything to do with style.