Share via


Tracepoints are AWESOME!

 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.

Comments

  • Anonymous
    March 16, 2006
    -- 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...
  • Anonymous
    March 16, 2006
    What about multiple monitors?
    Very useful when debugging GUI-code.
  • Anonymous
    March 17, 2006
    Oh man - thanks for the tip - this is going to minimize my insanity!
  • Anonymous
    March 17, 2006
    I too saw the light.

    http://josheinstein.com/journal/archive/2006/01/05/1257.aspx
  • Anonymous
    March 19, 2006
    The comment has been removed
  • Anonymous
    March 20, 2006
    The comment has been removed
  • Anonymous
    May 05, 2006
    Pour ceux qui ne seraient pas (encore) abonnés aux Z'actus d'ASP-MAGAZINE, voici une information concernant...
  • Anonymous
    August 01, 2006




    For the most part, activation and focus work pretty darn well in windows, until you want to tweak...
  • Anonymous
    March 16, 2007
    Pour ceux qui ne seraient pas (encore) abonnés aux Z'actus d' ASP-MAGAZINE , voici une information concernant