Debugging C# 3.0 Part II

Overview

In the last article I covered the "results view" for lazy evaluated collections like Queries/Enumerable and the use of extension methods in the watch and immediate window. For completeness I will cover stepping, range variables, anonymous types and Xlinq support and this will lead us into the SP1 work for debugging.

Stepping

Stepping has been extended to support the query execution. That is, when the query is being executed one can step though the query created or add break points for the same. This allows the user to actually see the flow of the execution though a query and find out how a particular element was retrieved from the enumerable.

image

The results view is marked as having side effects ( just like a method call) and is disabled during a step. This mean we don't have unwanted side effects or seeing the contents of a enumerable

image

Range Variables

The variables that are declared and used in queries can also be inspected when stopped in a query execution ( as shown in stepping). Here the variables in question might be nested under an transparent identifier and if so the top level transparent identifier is show in the locals window and the user can dig in though this object to find the variable he is looking for.

image

Anonymous Types

Since anonymous type are identified by their structure all instances of anonymous-types give a brief description of their structure (first 5 elements) in the value column. The name of the type is hidden as its an unparseable name in C#. All elements of the anonymous type are un editable( after the immutable dcr)

Xlinq Objects

Objects of type System.Xml.Linq.XNode or any derived type get the built in visualizers ( text, XML and html) and user can see the Xml data, with a few clicks.

This pretty much covers the work done to support debugging in VS 9, however as I will describe soon this leaves a pretty big hole when debugging queries where the range variables are under an transparent identifiers ( e.g. Color, agg, y etc from range variable eg). Secondly since anonymous types are unparseable any construct that contains an anonymous type ( think type argument , casts , ctors) are broken. These are some of the issues i will cover in my next post of VS 9 SP1.

kick it on DotNetKicks.com