That should stop the code and display a messagebox detailing the
assertion. But it doesn't. The text goes to the trace window, but I
want it to STOP my program. (You know, like an assertion failure SHOULD
do.)
Actually, System.Diagnostics.Debug is far from the only class with an Assert
method...
Debug.Assert(False)
That should stop the code and display a messagebox detailing the
assertion. But it doesn't. The text goes to the trace window, but I
want it to STOP my program. (You know, like an assertion failure SHOULD
do.)
See http://www.codeproject.com/aspnet/ASPNetDebugAssertion.asp for a way to
implement this. As for your original question of why it doesn't work as
expected automatically, my best guess would be that someone at Microsoft
decided this would probably cause too much pain when applications are
incorrectly deployed with debug configurations (which happens more often
than most of us might like to admit <g>).
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.