Tuesday, July 29, 2008
Tip #1 – datatips on comments
One of the coolest debugger features introduced in VS2005 was DataTips (grey editable, navigable tooltips on steroids that also become transparent when you hold down the Ctrl key). Did you know that you can get data tips for commented code? At first this made me raise an eyebrow, but I can see how for some piece of code I may always need to inspect some other variables quickly and do not want to have to enter them in the watch window manually or navigate to the required area from existing variables that do exist in code. Here is a screenshot that shows this feature in action:

Notice how the datatip appears after highlighting a variable that is in a commented area of the editor (my highlight is set to yellow).
Tip #2 – save output window
In Visual Studio many times we need to transfer the text from the Output window to an actual txt file. Dunno about you, but I always selected all (Ctrl+A), copied (Ctrl+C) and then pasted (Ctrl+V) into a notepad instance that I always have running (Alt+TAB). It turns out that there is a direct way of saving that output to a file. Simply hit Ctrl+S (or invoke it from the menu item) once you've given focus to the Output window – nice!
What cool debugger features do you like in Visual Studio (or would like to see)?
One of the coolest debugger features introduced in VS2005 was DataTips (grey editable, navigable tooltips on steroids that also become transparent when you hold down the Ctrl key). Did you know that you can get data tips for commented code? At first this made me raise an eyebrow, but I can see how for some piece of code I may always need to inspect some other variables quickly and do not want to have to enter them in the watch window manually or navigate to the required area from existing variables that do exist in code. Here is a screenshot that shows this feature in action:

Notice how the datatip appears after highlighting a variable that is in a commented area of the editor (my highlight is set to yellow).
Tip #2 – save output window
In Visual Studio many times we need to transfer the text from the Output window to an actual txt file. Dunno about you, but I always selected all (Ctrl+A), copied (Ctrl+C) and then pasted (Ctrl+V) into a notepad instance that I always have running (Alt+TAB). It turns out that there is a direct way of saving that output to a file. Simply hit Ctrl+S (or invoke it from the menu item) once you've given focus to the Output window – nice!
What cool debugger features do you like in Visual Studio (or would like to see)?
Labels: dot NET general
Comments:
_________________
Post a Comment
« Latest Posts
That first tip is awesome, thanks!
Another cool debugger feature is the flexibility of the breakpoints/tracepoints. Tracepoints are great for quickly monitoring a method and breakpoint conditions are great for filtering.
I think debugging in VS is getting better with each new version. Now that we can debug into Microsoft's code, we can find bugs even faster (and learn how MS developers do stuff).
_________________Another cool debugger feature is the flexibility of the breakpoints/tracepoints. Tracepoints are great for quickly monitoring a method and breakpoint conditions are great for filtering.
I think debugging in VS is getting better with each new version. Now that we can debug into Microsoft's code, we can find bugs even faster (and learn how MS developers do stuff).
Thanks for the tips, it's always great to boost one's productivity. Indeed, Visual Studio 2008 is a great productivity tool!
I love that hidden feature to see the value of variables in comments. Just neat!
It happens that I already knew of the ability to save the output window, and in fact it's a feature that has been bugging me. You see, I'm used to pressing Crtl-S all the time in whatever application in order not to loose any document. But when I build a solution the Output window comes out automatically (it's undocked in my configuration), and if I hit Ctrl-S it will pop-up the save dialog for me to save it. So it's just annoying for me, and in fact I didn't ever thought it could be useful to save the Output window's contents...
_________________I love that hidden feature to see the value of variables in comments. Just neat!
It happens that I already knew of the ability to save the output window, and in fact it's a feature that has been bugging me. You see, I'm used to pressing Crtl-S all the time in whatever application in order not to loose any document. But when I build a solution the Output window comes out automatically (it's undocked in my configuration), and if I hit Ctrl-S it will pop-up the save dialog for me to save it. So it's just annoying for me, and in fact I didn't ever thought it could be useful to save the Output window's contents...
A debugging tool that I'd love to see is the displaying of Bitmap objects when I hover over them. In numerous scenarios I've had to build images using a number of GDI+ and bit level operations where the resulting image isn't what I expected. It would be *really* great if I could step through my code looking at the image being created at each step, to see where it is going wrong.
_________________
I'm a big fan of System.Diagnostics.Debugger.Break() method which enables us to attach a debugger to the process at that line (via Just-In-Time debugger selection dialog). This is especially useful when you can't use "Attach to Process..." command in VS, for example missing execution of that line before you attach.
_________________
I like the Make Object ID feature in the Locals and Watches windows but in my solutions with both VB and C# projects it's annoying that the feature only works on C# variables, not VB variables.
Considering this is a debugger tool I'm surprised it's language dependent.
Regards,
_________________Considering this is a debugger tool I'm surprised it's language dependent.
Regards,
_________________
Andy : you can do just that using Visualizers ( http://msdn.microsoft.com/en-us/library/zayyhzts.aspx ).
There is a great video up on channel 9 about them ( http://channel9.msdn.com/posts/Charles/Scott-Nonnenberg-Visualizers-in-VS-2005/ )
_________________There is a great video up on channel 9 about them ( http://channel9.msdn.com/posts/Charles/Scott-Nonnenberg-Visualizers-in-VS-2005/ )
It would be nice to have a Debug.Clear() function callable from code.
There's a hack to do it by including references to the IDE in the projetc but I never got it work... and what a ballache!
Good article, thanks.
Ben
_________________There's a hack to do it by including references to the IDE in the projetc but I never got it work... and what a ballache!
Good article, thanks.
Ben
Tommy: Yes Tracepoints was one of my favourite features when it came out (for those not familiar with that, see 3 links from my post here). I also I love the ms source debugging (see my video here).
Arnaud: I am not sure how you get yourself in that situation: If you Ctrl+S in the editor then the right thing happens, unless you put the focus to the output window first, which requires explicit action. Having said that I have 2 relevant tips for you: #1 set the option to have your work saved automatically on F5 (so you don't have to Ctrl+S when running). #2 Use Ctrl+Shift+S, which saves all open files.
Andy: Debugger Visualizers offer that. See my post linking to a few image visualizers.
Huseyin: I don’t use that feature as often but that's probably cause I don't troubleshoot as much these days as I used to. It's a neat feature though.
Jason: I didn't even know about that feature – thanks for sharing!
Anonymous: Yeah, it works everywhere doesn't it :)
Paul: Thanks for the additional (to mine) links!
benbenbenbenben: I'll pass that suggestion to the appropriate person.
_________________Arnaud: I am not sure how you get yourself in that situation: If you Ctrl+S in the editor then the right thing happens, unless you put the focus to the output window first, which requires explicit action. Having said that I have 2 relevant tips for you: #1 set the option to have your work saved automatically on F5 (so you don't have to Ctrl+S when running). #2 Use Ctrl+Shift+S, which saves all open files.
Andy: Debugger Visualizers offer that. See my post linking to a few image visualizers.
Huseyin: I don’t use that feature as often but that's probably cause I don't troubleshoot as much these days as I used to. It's a neat feature though.
Jason: I didn't even know about that feature – thanks for sharing!
Anonymous: Yeah, it works everywhere doesn't it :)
Paul: Thanks for the additional (to mine) links!
benbenbenbenben: I'll pass that suggestion to the appropriate person.
Post a Comment
« Latest Posts
Copyright © Daniel Moth





