Skip to content

Context menu

Zev Spitz edited this page Jun 26, 2019 · 7 revisions

Each node on the treeview has a context menu:

Context menu

The following commands are available:

Copy watch expression

If you want to add a particular node as a watch expression to the Visual Studio Watch window, it's not enough to write the path:

expr.Body.Left

because the return type of Body is an Expression, but the Left property exists only on BinaryExpression. You therefore have to cast Body to BinaryExpression like this:

((BinaryExpression)expr.Body).Left

It can become rather complex to write, so this command copies the expression + casting to the clipboard.

This command respects the value of the Language setting -- if Visual Basic is selected, then CType will be used for the casts.

(Ideally, the command would actually add the watch, instead of just copying the necessary expression to the clipboard; tracked under #75.)

Note -- the visualizer API doesn't expose the expression currently being debugged by the visualizer (issue filed here), so you'll be prompted to enter it the first time this command is used:

Prompt for debugged expression

This value can be changed from the Expression field on the visualizer.

Help links

Each node can have a number of links to docs.microsoft.com.

| Name | Description | Example | | -- | -- | -- | -- | | Property| The property of the parent node which gets to this node | BinaryExpression.Left | | Node type | Expression.NodeType for Expression
MemberBinding.BindingType for MemberBinding
GotoExpression.Kind for GotoExpression (#77) | ExpressionType.MemberAccess | | Base type | Public types in the inheritance/implementation tree of the node object's type | MemberExpression | | Factory method | For BinaryExpression and UnaryExpression, the specific factory method which creates this node's object
Otherwise, the factory methods which return the same type as the node object | Field |

Open value in new window

For expressions with a value -- ConstantExpression, or MemberAccessExpression that represent closed-over variables -- you can open a new instance of the visualizer for the value.

For example, in the following screenshot, the lambda expression returns the closed-over variable expr1; the second window shows the value at expr1 in a new visualizer instance.

Open value in new window

Clone this wiki locally