Bite my bytes

What I learn by day I blog at night - A blog from Microsoft Consultant working from Ljubljana, Slovenia

  Home :: Contact :: Syndication  
  999 Posts :: 7691 Comments :: 235 Trackbacks

Search

Most popular posts
in last 180 days

Categories

My Projects

Archives

Stuff


Copyright © by David Vidmar
 
Contact me!
 
LinkedIn Profile
 
 
 

I have been annoyed with this for a long time. And solution has been sitting in front of my nose all this time!

There are times, when you want VisualStudio.Net debugger not to step in some methods when debugging. This comes really handy when you have something like this:

DoSomething(ConvertDefault.ToDouble(lubPartner.KeyValue));

If you want to step in DoSomething() you have to press F11. But since LookupButton.KeyValue is a field with accessors and since your calling the method ConvertDefault.ToDouble(), the debugger will first step in those methods. Really anoying!

One solution is to set the brakepoint inside DoSomething() but that two mouse clicks too much.

The real solution is System.Diagnostics.DebuggerStepThroughAttribute(). Set it to and debugger doesn't step in a method marked with this attribute but does allow a breakpoint to be set in the method.

[System.Diagnostics.DebuggerStepThroughAttribute()]
public double ToDouble(object _o) {
  ...
}

You can only set it to method, but fear not! Property accessors are methods, so put the attribute in front of accessor!

public object KeyValue {
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  get {
    ...
  }
}

Simple as that!

Posted on Friday, May 07, 2004 2:12 PM | Filed under: Developement |

Feedback

# SquishyCool! 6/3/2004 9:01 AM vidmar.net/weblog


Comments have been closed on this topic.