简体   繁体   English

Visual Studio-在不处于调试模式时逐步进行操作

[英]Visual Studio - step through when not in debug mode

I am looking through a huge amount of some one else's code (all class libraries) which is pretty complex for me. 我正在浏览大量其他人的代码(所有类库),这对我来说很复杂。 One of the reasons is the previous developer has many, many nested methods (if such a term exists). 原因之一是以前的开发人员有很多很多嵌套的方法(如果存在这样的术语)。 For example 例如

string = DoThis(CheckThat(WasThisRight(DontForgetTo(AhYouNearlyDidntDo("")ToString().ToLower().Replace("this", "that").ExtensionMethodChaosBegins();

Now, I can select the method with the mouse and hit F 12 but it's less efficient then just pressing F 11 (for a few reasons). 现在,我可以用鼠标选择方法并按F 12键,但效率不如按F 11键 (出于某些原因)。

So, is it possible to step through code when not in debug mode but whilst in design mode? 因此,是否可能不在调试模式下但在设计模式下单步执行代码?

It's probably easier to do this in debug mode. 在调试模式下执行此操作可能更容易。 Remember that there's also F10 for stepping over lines you don't want to step into, and Shift + F11 if you've stepped into something you want to get out of. 请记住,还有F10用于跨过您不想跨入的行,而Shift + F11如果您跨入了想要摆脱的障碍。

You already know of F12 to go to declaration, but remember also Shift + F12 which will show all places where the member is used. 您已经知道要声明的F12 ,但还要记住Shift + F12 ,它将显示使用该成员的所有位置。

在这种情况下,Resharper的重构工具可能是天赐之物。

I think you might find Debugger Canvas useful. 我认为您可能会发现Debugger Canvas有用。 It shows functions in their own little bubbles and shows the call stack visually, left to right, of the code you're working in 它以自己的小气泡显示函数,并从左至右直观地显示您正在使用的代码的调用堆栈

It's even in the MSDN! 甚至在MSDN中!

You can do a dry run of the code by using f12 to "jump into" a called method. 您可以使用f12 “跳入”被调用的方法来进行代码的f12运行。 To jump back out to the calling method when you hit a "return", you can use ctrl+minus . 要在单击“返回”时跳回到调用方法,可以使用ctrl+minus This allows you to manually emulate the stack when walking the source code. 这样,您可以在遍历源代码时手动仿真堆栈。

(Note that ctrl+minus actually jumps the cursor position through a stack of saved states, so if you move the cursor around too much in the called method, you will end up with multiple stacked states that you have to cycle through before you will actually return to the calling function) (请注意,ctrl +减号实际上会使光标位置跳过一堆保存的状态,因此,如果您在被调用的方法中将光标移动太多,则最终将有多个层叠状态,您必须先循环遍历,然后才能实际使用返回调用函数)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 单击逐步了解Visual Studio - Step Through Visual Studio On Click Visual Studio 2017-在调试模式下无法查看变量 - Visual Studio 2017 - Cant view variables when in debug mode XUnit在Visual Studio中的调试模式下声明异常 - XUnit Asserting Exceptions In Debug Mode In Visual Studio 在调试模式下Visual Studio行高亮显示 - Visual Studio line highlight in Debug mode 在调试模式下在Visual Studio 2008中编辑代码 - Editing code in Visual Studio 2008 in debug mode 在Visual Studio调试模式下运行时重新启动应用程序 - Runtime restart application in visual studio debug mode 在调试模式下禁用跟踪 Visual Studio 2013 - Disable traces in debug mode visual studio 2013 逐步进入Visual Studio中引用的程序集代码 - Step in through referenced assemblies code in Visual Studio 有什么方法可以使用 UI 进行自上而下的调试,以单步调试 Visual Studio C# windows forms 中的特定代码? - Is there any way to debug top down using the UI to step through and target specific code in Visual Studio C# windows forms? Visual Studio 2015调试错误“无法执行,一般异常” - visual studio 2015 debug error “unable to step, general exception”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM