Enable breakpoint B if breakpoint A has been hit

前端 未结 2 467
不知归路
不知归路 2021-01-31 18:58

I\'m often find myself setting a breakpoint A somewhere in the code and manually enabling one or more breakpoints when this breakpoint is hit. A typical case is when I\'m debugg

2条回答
  •  隐瞒了意图╮
    2021-01-31 19:27

    You can get the dependent breakpoints even without changing the code, by using some global storage to hold the marker that will enable dependent breakpoint.

    One of the most accessible storages that I've found is app domain custom properties. They can be accessed by System.AppDomain.CurrentDomain.GetData and SetData methods.

    So on first breakpoint you define a "when hit" setting with :

    {System.AppDomain.CurrentDomain.SetData("break",true)}

    breakpoint condition

    On the dependent breakpoint, set hit condition to:

    System.AppDomain.CurrentDomain.GetData("break") != null

提交回复
热议问题