My code base has a lot of #if DEBUG/#endif
statements that mostly have assertion type logic that I'm not brave enough to run in production.
[Conditional("DEBUG")]
public void CheckFontSizeMath()
{
//This check must not block SellSnakeOil() in production, even if it fails.
if(perferredSize+increment!=increment+preferredSize)
throw new WeAreInAnUnexpectedParallelUniverseException();
}
Will I regret changing all these over to the new way of doing things?
UPDATE: I'm looking for the difference between characteristics of two similar but different syntax styles for doing Assertions. I understand there is a world of other ways to do demonstrate applications work, and I do those, too. I'm not ready to give up Assertions altogether.
Also I updated the method name for a realistic debug-release-only scenario.
There's no problem doing this. The more current approach is to use Code Contracts.