<assert> Element

Specifies whether to display a message box when you call the Debug.Assert method; also specifies the name of the file to write messages to.



<assert assertuienabled="true|false" logfilename="file name"/>  

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.


Attribute Description
assertuienabled Optional attribute.

Specifies whether to display a message box when the Debug.Assert method evaluates to false.
logfilename Optional attribute.

Specifies the name of the file to write the message to if Debug.Assert evaluates to false.

assertuienabled Attribute

Value Description
true Displays the message box. This is the default.
false Does not display the message box.

Child Elements


Parent Elements

Element Description
configuration The root element in every configuration file used by the common language runtime and .NET Framework applications.
system.diagnostics Specifies trace listeners that collect, store, and route messages and the level where a trace switch is set.


Both attributes in the <assert> element are optional. You can disable message boxes without specifying a file to write the messages to, or you can specify a file to write messages to while leaving message boxes enabled.


The following example shows how to disable displaying message boxes when you call Debug.Assert and write the messages to c:\log.txt.

      <assert assertuienabled="false" logfilename="c:\log.txt"/>  

See also