Do you use Trace.Fail or set AssertUIEnabled="true" in your web.config?

Last updated by Chloe Lin [SSW] about 1 month ago.See history

Have you ever seen dialogs raised on the server-side? These dialogs would hang the thread they were on, and hang IIS until they were dismissed. In this case, you might use Trace.Fail or set AssertUIEnabled="true" in your web.config.

See Scott's blog Preventing Dialogs on the Server-Side in ASP.NET or Trace.Fail considered Harmful

 public static void ExceptionFunc(string strException)
{
    System.Diagnostics.Trace.Fail(strException);
}

Figure: Never use Trace.Fail <configuration>

   &lt;system.diagnostics&gt;
      &lt;assert AssertUIEnabled="true" logfilename="c:\log.txt" /&gt;
   &lt;/system.diagnostics&gt;
&lt;/configuration&gt;
Figure: Never set AssertUIEnabled="true" in web.config &lt;configuration&gt;
   &lt;system.diagnostics&gt;
      &lt;assert AssertUIEnabled="false" logfilename="c:\log.txt" /&gt;
   &lt;/system.diagnostics&gt;
&lt;/configuration&gt;

Figure: Should set AssertUIEnabled="false" in web.config


Adam Cogan
Ryan Tee
We open source.Loving SSW Rules? Star us on GitHub. Star
Stand by... we're migrating this site to TinaCMS