Skip to content
| Marketplace
Sign in
Visual Studio>Tools>Expression Debug Visualizer
Expression Debug Visualizer

Expression Debug Visualizer

Andy Lamb

|
8,842 installs
| (4) | Free
A debug visualizer that renders a lambda expression as a binary decision tree.
Download

Rendering complex lambda expressions as binary decision trees makes them easier to reason about for technical and non-technical users. Trace the flow through the decision tree followingTrue and False branches at each node until a leaf is reached.

Note: The expression must be bound to a variable to support debugging tool tips and, therefore, debug visualizers. See the code below for an example.

Usage: Hover over a lambda expression variable name ('expr' in the below examples) whilst deugging to display its value in a tool tip. Click on the magnifying glass icon in the tool tip to load the Expression Debug Visualizer.

 

Predicate expressions, as shown below used in a Linq Where clause, render to a binary decision tree terminating in a boolean value. 

C#
Edit|Remove
csharp
Expression<Func<string, bool>> expr = s => s != null                                   && (s == "Example" || s == "Demo");IEnumerable<string> result = strings.Where(expr);
Expression<Func<string, bool>> expr = s => s != null                                    && (s == "Example" || s == "Demo");  IEnumerable<string> result = strings.Where(expr);

Ternary expressions, as shown below used in a Linq Select clause, render to a binary decision tree terminating in an instance of the return type defined by the expression.

C#
Edit|Remove
csharp
Expression<Func<int, string>> expr = i => i == 0 ? "Zero"                                   : i < 0 ? "Negative"                                   : i % 2 == 0 ? "Even"                                               : "Odd";IEnumerable<string> result = integers.Select(expr);
Expression<Func<int, string>> expr = i => i == 0 ? "Zero"                                    : i < 0 ? "Negative"                                    : i % 2 == 0 ? "Even"                                                : "Odd";  IEnumerable<string> result = integers.Select(expr);
 

Comments and suggestions are welcome.  

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft