Given the code
鉴于代码
[Test]
public void Test1()
{
var a = new A();
a
.Method1()
.Method2();
}
is it possible to set a breakpoint so that execution pauses after Method1() has executed, but before Method2 without going to the definition of Method2 and putting a breakpoint there? When I do it, the breakpoint appears at the 'a'.
是否有可能设置一个断点,以便在执行Method1()之后暂停执行,但在Method2之前没有进入Method2的定义并在那里放置一个断点?当我这样做时,断点出现在'a'。
3 个解决方案
#1
0
No, the debugger's unit of executable code is a statement. There are only two in the method body in your snippet. Post feature requests to connect.microsoft.com. It's going to be a hard sell, it is not technically impossible but a potentially heavy re-engineering effort.
不,调试器的可执行代码单元是一个语句。您的代码段中的方法正文中只有两个。将功能请求发布到connect.microsoft.com。这将是一个艰难的销售,它在技术上不是不可能的,但可能是一个重大的重新设计努力。
#2
5
you can't set a breakpoint there, but you can set your breakpoint on the whole statement, and then use the "Step into Specific >" command on the right-click menu (Debug.StepIntoSpecific) to step into Method2().
你不能在那里设置一个断点,但你可以在整个语句中设置断点,然后在右键菜单(Debug.StepIntoSpecific)上使用“Step into Specific>”命令进入Method2()。
you can also do repeated step in/step out to step through the indivdual method calls of the compound statement.
你也可以重复一步/步出来逐步执行复合语句的单独方法调用。
#3
2
Use Rider instead of Visual Studio. IntelliJ Idea is capable of logical step in when fluent syntax is used. It is 2017 and fluent syntax is everywhere (LINQ). Shame on Visual Studio (even 2017).
使用Rider而不是Visual Studio。当使用流畅的语法时,IntelliJ Idea能够合乎逻辑地进入。它是2017年,流畅的语法无处不在(LINQ)。对Visual Studio感到羞耻(甚至是2017年)。
#1
0
No, the debugger's unit of executable code is a statement. There are only two in the method body in your snippet. Post feature requests to connect.microsoft.com. It's going to be a hard sell, it is not technically impossible but a potentially heavy re-engineering effort.
不,调试器的可执行代码单元是一个语句。您的代码段中的方法正文中只有两个。将功能请求发布到connect.microsoft.com。这将是一个艰难的销售,它在技术上不是不可能的,但可能是一个重大的重新设计努力。
#2
5
you can't set a breakpoint there, but you can set your breakpoint on the whole statement, and then use the "Step into Specific >" command on the right-click menu (Debug.StepIntoSpecific) to step into Method2().
你不能在那里设置一个断点,但你可以在整个语句中设置断点,然后在右键菜单(Debug.StepIntoSpecific)上使用“Step into Specific>”命令进入Method2()。
you can also do repeated step in/step out to step through the indivdual method calls of the compound statement.
你也可以重复一步/步出来逐步执行复合语句的单独方法调用。
#3
2
Use Rider instead of Visual Studio. IntelliJ Idea is capable of logical step in when fluent syntax is used. It is 2017 and fluent syntax is everywhere (LINQ). Shame on Visual Studio (even 2017).
使用Rider而不是Visual Studio。当使用流畅的语法时,IntelliJ Idea能够合乎逻辑地进入。它是2017年,流畅的语法无处不在(LINQ)。对Visual Studio感到羞耻(甚至是2017年)。