<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.
<configuration> Element
<system.diagnostics> Element
<assert> Element
<assert assertuienabled="true|false" logfilename="file name"/>
Attributes and Elements
The following sections describe attributes, child elements, and parent elements.
Attributes
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
None.
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. |
Remarks
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.
Example
The following example shows how to disable displaying message boxes when you call Debug.Assert and write the messages to c:\log.txt.
<configuration>
<system.diagnostics>
<assert assertuienabled="false" logfilename="c:\log.txt"/>
</system.diagnostics>
</configuration>