So I was debugging a function this week that is called whenever my program is focused, which leads to a huge frustration when setting a breakpoint in it. (You know the moment you F5 your debugger, then ALT+Tab back, the focus logic strikes again and you're back where you were a millisecond ago in the debugger.)
Typically to work around these situations, I've slapped in a few Debug.WriteLines, and started all over from scratch. But this is annoying and time consuming, and I'm not always debugging code I can change. Some folks solve this problem by using remote debugging, but if I'm too lazy to put in a Debug.WriteLine, I'm CERTAINLY too lazy to remote debug.
So I stumbled across a new feature (which folks have mentioned to me several times before but I had not yet seen the light).
When you set a breakpoint in VS 2005, right click on it the next time, and select the "When hit..." option. This will change your breakpoint into a tracepoint! A tracepoint does not stop the debugger, it simply spews output into the output window when it is hit.
So, the next time you're debugging something in VS, take a minute, right click and enjoy the wonder that is "when hit".
Instructions for creating a tracepoint.
— Microsoft Products Developed in .NET A brief summary of the approximate number of lines of .net code in various MS products, which is a question I’ve seen asked by a lot of people in a lot of places. Not…
What about multiple monitors?
Very useful when debugging GUI-code.
Oh man – thanks for the tip – this is going to minimize my insanity!
I too saw the light.
http://josheinstein.com/journal/archive/2006/01/05/1257.aspx
Roger,
Multi-mon helps with some UI code, but there’s still a big class of issues where having the focus move to the debugger mucks things up.
I disagree with Chris about remote debugging. I’m pretty lazy as well, but I do remote debugging all the time. All you need is a way to interrupt your program when it starts – a parameter that calls MessageBox works well – and then you can easily attach and debug.
I do spend a lot of time switching on my switchbox.
I read this, and I’m hooked!  Visual Studio drives me mad when it snatches focus back when you hit…
Pour ceux qui ne seraient pas (encore) abonnés aux Z’actus d’ASP-MAGAZINE, voici une information concernant…
For the most part, activation and focus work pretty darn well in windows, until you want to tweak…
Pour ceux qui ne seraient pas (encore) abonnés aux Z’actus d’ ASP-MAGAZINE , voici une information concernant