Lesson 4 of 40
Debugging
Advanced
45 min
Advanced Debugging Techniques
Go beyond breakpoints. Learn time-travel debugging, AI-powered exception analysis, hot reload, and snapshot debugging in VS 2026.
Part 1: Time-Travel Debugging (IntelliTrace)
IntelliTrace in VS 2026 records your program's execution history. Navigate backwards through execution to find the root cause:
- Enable via Debug → Options → IntelliTrace → On (Events and Calls)
- Use the Diagnostic Tools window to see execution events
- Click any past event to jump to that exact state
Part 2: AI Exception Analysis
When an exception is thrown, Copilot automatically analyzes the call stack:
// Exception thrown: NullReferenceException
// ✦ Copilot Analysis:
// 'order.Customer' is null because GetOrderAsync()
// doesn't include Customer in the EF Core query.
// Suggested fix: Add .Include(o => o.Customer)
Click "Apply Fix" directly from the exception helper.// ✦ Copilot Analysis:
// 'order.Customer' is null because GetOrderAsync()
// doesn't include Customer in the EF Core query.
// Suggested fix: Add .Include(o => o.Customer)
Part 3: Hot Reload & Edit-and-Continue
VS 2026 expands Hot Reload to support more C# edits without restarting:
- Add/remove methods and properties
- Change method bodies and lambda expressions
- Modify async state machines
Part 4: Conditional & Data Breakpoints
// Right-click breakpoint → Conditions
// Condition: order.Total > 1000 && order.Status == "Pending"
// Hit Count: Break when hit count equals 5
// Data Breakpoint (value changes):
// Debug menu → New Data Breakpoint → &variable
Data breakpoints halt execution the moment a memory address changes value — invaluable for tracking down mutations.// Condition: order.Total > 1000 && order.Status == "Pending"
// Hit Count: Break when hit count equals 5
// Data Breakpoint (value changes):
// Debug menu → New Data Breakpoint → &variable