3 New Favorite Techniques in Visual Studio
Here’s 3 techniques in Visual Studio that have lately become favorites of mine.
Breakpoint Output Logging
In my previous post on output logging with breakpoints, my colleague Ken Overton, pointed out the existence of something that used to be called “TracePoints”. I went looking for these mythical beasts and was pleasantly surprised to find the “When Hit” option for breakpoints. It’s available in the breakpoint right click menu.
You can output text and variable values when the breakpoint is hit instead of stopping:
The logging will show in the Output Window. On the downside, it slows down program execution speed, seemingly more than conditional and regular breakpoints.
My colleague Andrei Kashcha, master extraordinaire of debugging techniques, shared this with me and I’m starting to use it regularly. When you make an “object id” for a class instance, its a globally available reference to that instance for debug inspection and can be used to breakpoint in a single instance or verify which instance you are looking at.
To “Make Object ID”, just select that in the watch window context menu for an initialized variable.
That instance can now be referenced globally as 1#:
And to breakpoint in just that instance, set a conditional breakpoint with the condition “this == 1#”:
ReSharper Class List Navigator
I see a lot of people using this, but its recently become my goto navigation method. For those of us ReSharper fans (with standard R# key mappings), just press ctl-t and up pops a handy class navigator that supports filtered search with partial class name and Pascal Cased abbreviations such as AVLCN for AVeryLongClassName.
No comments yet.