Trace.Assert
using System; using System.IO; using System.Diagnostics; class MainClass { [STAThread] static void Main(string[] args) { int i = 0; Trace.Assert((i == 1), "My Trace Assertion"); } }