In this page:


Debug Techniques

csharp

// Debugging Methods
public class DebugScript
{
    public void DebugExample()
    {
        // Console output (appears in logs)
        Console.WriteLine($"Debug: Starting process at {DateTime.Now}");
        
        // Conditional debugging
        #if DEBUG
        Console.WriteLine("Debug mode - detailed logging enabled");
        var stopwatch = Stopwatch.StartNew();
        #endif
        
        // Debug tags
        @Tag.Debug.LastRun = DateTime.Now;
        @Tag.Debug.ExecutionTime = stopwatch.ElapsedMilliseconds;
        
        // Breakpoint (in Designer test mode)
        System.Diagnostics.Debugger.Break();
        
        // Trace information
        Trace.WriteLine("Trace: Process completed");
        Trace.Assert(@Tag.Value > 0, "Value should be positive");
    }
}


In this section...