Martin Marconcini
Martin Marconcini

Reputation: 27236

How to tell Visual Studio to not navigate away from current file on Break All?

Is there a way to avoid Visual Studio from going to another file when pausing a session?

If you’re debugging a class somewhere else and the code is called from a form which in turns executes a ShowDialog(); (or similar), if you suddenly pause the application, Visual Studio will switch to the file (which sometimes is the Main() method). I’d like to stay in the file I have in front of me, since I usually need to add/remove waypoints or change code and it’s annoying (if you have too many open files) to go back to the point where i was before the pause.

Couldn’t find the option.

Upvotes: 3

Views: 1018

Answers (3)

Mohamed Jawad
Mohamed Jawad

Reputation: 33

One more work around - U can press CTRL-F4 to close the navigated file instantly and go back to your desired file !

Upvotes: 1

Jarek Kardas
Jarek Kardas

Reputation: 8455

Latest build of VSCommands extension (free version) available from http://visualstudiogallery.msdn.microsoft.com/a83505c6-77b3-44a6-b53b-73d77cba84c8 has just what you want. It adds a Break In Current Document button to Debug Toolbar and Debug Menu:

http://vscommands.squaredinfinity.com/Media/VSCommands/BlogPost//blog/breakincurrentdocument.png

Upvotes: 4

Daniel Robinson
Daniel Robinson

Reputation: 2245

I'm not sure exactly how to solve your problem, but perhaps you may want to use one of the following methods for easily returning to the exact point you were interested in:

A. (From the Menu) View -> Navigate Backward. I have this bound to a key combination I find easy. Note that this only works positions in the code where you have actually been editing / navigating with the cursor.

B. Add a bookmark to the line you're interested in returning to with the key combination Ctrl-K, Ctrl-K. You can view, name, and navigate to all your bookmarks via the bookmark window. You can also navigate through your bookmarks via the key combination Ctrl-K, Ctrl-N

Upvotes: 2

Related Questions