How to set a breakpoint in every method in VS2010

后端 未结 6 1173
小蘑菇
小蘑菇 2020-12-31 02:33

I have a bigger (c#) WPF application with n-classes and m-methods. I would like to place in every single method a breakpoint, so everytime i press

6条回答
  •  粉色の甜心
    2020-12-31 03:03

    I think you create an 'aspect' for it using a tool like: postsharp

    Aspect oriented programming allows you to add code to the start or end of every method (through a postprocessing step). So it's trivial to add the line:

     System.Diagnostics.Debugger.Break()
    

    to every method (without actually editing all your sourcecode). More typically it is used to add log statements to the beginning of every method like: "Entering method DrawLine(x=30,y=80,z=12)" and at the end of a method: "Leaving method DrawLine(x,y,z)". Which makes following the flow of your program easy

提交回复
热议问题