April 12, 2006
Do not call "Debug::Assert" in C++/CLI !
If you are used to C# and to the new “Debug::Assert” method, you tend to use this method in C++/CLI. This is a good intention, but a bad idea ;-)
The problem is that the supression of this method in release-builds in C# and VB.NET is done by the compiler, which looks for ConditionalAttribute(“DEBUG”). If such an attribute is present the method call will be eliminated through the compiler. So this is not a feature of the runtime!
And the C++/CLI compiler has forgotten to implement this compiler-feature… So the method is still called in release builds and will trigger an dialog if the condition is false…
The same is also true for all other methods that has the ConditionalAttribute (=> Debug::Fail/Write(Line)/Write(Line)If/Unindent/...)
The trackback url for this post is http://blog.kalmbachnet.de/bblog/trackback.php/78/
Comments have now been turned off for this post