简体   繁体   中英

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).

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.

You already know of F12 to go to declaration, but remember also Shift + F12 which will show all places where the member is used.

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

I think you might find Debugger Canvas useful. 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!

You can do a dry run of the code by using f12 to "jump into" a called method. To jump back out to the calling method when you hit a "return", you can use 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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM