Trace.Assert to console

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • S. Han

    #1

    Trace.Assert to console

    I use Trace.Assert() in my app.config, and I added
    <system.diagnos tics>
    <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?


  • Jens Thiel

    #2
    Re: Trace.Assert to console

    "S. Han" <@> wrote:[color=blue]
    > I use Trace.Assert() in my app.config, and I added
    > <system.diagnos tics>
    > <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[/color]
    continues[color=blue]
    > executing past the assertion point.
    >
    > Is there any configuration switch that makes the app to abort at an
    > assertion error?[/color]

    Implement a trace listener, override Fail() and call
    System.Diagnost ics.Debugger.Br eak()


    Jens.

    --
    http://ManagedXLL.net/ | http://jens-thiel.de/ | http://QuantLib.net/
    Replace MSDN with my first name when replying to my email address!


    Comment

    Working...