Overview

Over the past few months I have been busy closing VS 2008 and working on some fixes for SP1. We have enabled some key debugging scenarios in C# in VS 2008 SP1, they include support for 

  1. Range Variables in Queries &
  2. Anonymous Types
  3. Generic Type arguments

Covering all of them was making the post long so i am going to discuss Range variables this time and continue on with the other 2 in the next post.

Range variables

Range variables are the variables defined and used in a query. Currently they have a limitation in that they are not recognized as "true" local variables when stopped/stepping though a query. And since queries are one of the newest constructs in C#, are a prime candidate for SP1.

Range variables cannot currently be inspected in the watch window or in data tips(hover over them), quick watch and immediate. They can only be seen in the locals window,  but the display shows the internal transparent identifier created for the query. This leaves the variable of interest to the user nested and difficult to understand and use.  This happens as long as the user adds

1. A second from,

int[] ints = new int[] { 1, 2, 3, 45, 56 };

var q = from i in ints
            from k in ints
            where i > k      //add BP here
            select i + k;

clip_image002

2. A join or

image

3. A let clause to their query,

image

Seeing these simple examples it is not hard to imagine the debugging state when stopped in queries that use many of these in combination.

image

Here "Hover over" does not work, can't add anything to watch, the transparent identifier gets larger and the lvl of nesting makes it very hard to find the range variables your looking for.

SP1 Changes

All of these issues are now fixed in SP1 and the user has the full set of debugging tools for him to help inspect and evaluate the current state when stopped at a break-point. using the same example

image

Conclusion

In concluding this article, As always I am very interested in

  1. Any others pain points you have discovered while debugging or
  2. Things are are hard to debug.
  3. Things that would be nice to inspect etc.

Looking forward to your feedback. Cheers

kick it on DotNetKicks.com