Search code examples
visual-studiodebuggingmacrosbreakpoints

Is there a Visual Studio macro to set a breakpoint on the start of every method in a class?


Is there a Visual Studio macro (either for version 2008 or 2010) to set a breakpoint on the start of every method in a class?

I've seen hints of references, but I've not been able to dig an actual one out.


Solution

  • Wouldn't you be better off just single-stepping through your source code?

    I can't imagine why a breakpoint at the start of every method would be any better than single-stepping. You're going to end up breaking everywhere anyway, and single-stepping provides the additional advantage of showing you the logical flow of your code paths.

    You'll probably definitely want to learn the keyboard shortcut keys, but they can depend on how you have your VS environment set up. Look in your "Debug" menu for the "Step Over" and "Step Into" items. (Normally, Step Over is F10 and Step Into is F11.) The only difference is that, if the currently highlighted line contains a function call, Step Into will allow you to single-step through the code in the called function (this is probably most like what you want to do), while Step Over will simply call the function and stop on the next line in the current function.