Last week, I got reports back of errors in a patch I let someone try
out (release dll, but not from the build machine). Turns out it was
some Debug::Assert statements firing.
In umanaged code, I'd always understood that assertions were only
fired in debug builds and would compile down to NOPs in release builds
(for good reasons)
Now it looks as though I have to be careful to code assertions
conditionally?
#ifdef _DEBUG
Debug::Assert( false );
#endif
as opposed to
ASSERT( FALSE );
What's the thinking behind the change?
Regards,
Duncan
David Lowndes - 04 Oct 2007 16:23 GMT
>Last week, I got reports back of errors in a patch I let someone try
>out (release dll, but not from the build machine). Turns out it was
[quoted text clipped - 16 lines]
>
>What's the thinking behind the change?
Duncan,
This quirk would appear to be specific to C++/CLI usage. Using
Debug.Assert from C# (I presume VB is the same) doesn't generate any
code in release builds.
The documentation does say "C++ does not support the Debug class
methods." - which in itself seems rather odd because it clearly works
but has the quirk that its not removed in release builds.
This offers some explanation of why the situation is as it is:
http://blog.kalmbachnet.de/?postid=78
There's also a bug report on this here (you might want to add a vote
to it) - note it's still the same with Orcas B2:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=98820
Dave