In nunit or other test framework, we have Assert object to test whether result is as expected. If assert is false, then en exception is through. Trace.Assert is provide similar function, but for different purpose. It is for diagnostic. When assert is false, it output the error message to a listener. There is default listener in .net, which is DefaultTraceListener An instance of this class is automatically added to the Debug..::.Listeners and Trace..::.Listeners collections. Explicitly adding a second DefaultTraceListener causes the message also show in the debugger output window and the messageboxe for asserts. The DefaultTraceListner looks like throwing an exception, but it is not actually an exception, it is for user interaction and there is no exception to catch at all. If you remove the DefaultTraceListner like below, you will not see this output, and the execution will continue.

<img style=”cursor:pointer; cursor:hand;width: 400px; height: 70px;” src=”http://1.bp.blogspot.com/_yUba7cqllFE/SUp5G3ixumI/AAAAAAAAAPw/LGnV259pTc4/s400/assertfail.PNG” border=”0” alt=”“id=”BLOGGER_PHOTO_ID_5281166671941319266” />

<configuration>
  <system.diagnostics>
    <trace>
      <listeners>
        <clear/>
        <add name="text" />
      </listeners>
    </trace>
    <sharedListeners>
      <add name="text" type="System.Diagnostics.TextWriterTraceListener" initializeData="textfileListner.log" />
    </sharedListeners>
  </system.diagnostics>
</configuration>