Trace.Assert to console

  • Thread starter Thread starter S. Han
  • Start date Start date
S

S. Han

I use Trace.Assert() in my app.config, and I added
<system.diagnostics>
<assert assertuienabled="false" />...

so that I could redirect the assertion failure to the console output. The
problem is that when the assertion is triggered my C# application continues
executing past the assertion point.

Is there any configuration switch that makes the app to abort at an
assertion error?
 
S. Han said:
I use Trace.Assert() in my app.config, and I added
<system.diagnostics>
<assert assertuienabled="false" />...

so that I could redirect the assertion failure to the console output. The
problem is that when the assertion is triggered my C# application continues
executing past the assertion point.

Is there any configuration switch that makes the app to abort at an
assertion error?

Implement a trace listener, override Fail() and call
System.Diagnostics.Debugger.Break()


Jens.
 
Back
Top