How to enable the 'Locals' tab in Visual Studio? - visual-studio

I've tried running the debugger in VS. I see the error list, but I could not find the local tab to tell me what is going on inside the code. Would someone please tell me how to enable the tab?

You can use the hotkey chord: Ctrl+Alt+V then L
Or, while running your program, select on the toolbar: Debug > Windows > Locals

Related

Visual Studio 2013 doesn't show local variable values during debugging

My VS2013 doesn't show local variable values when I start debugging by setting a breakpoint as shown in the attached picture with red question mark. I have already checked "Use Managed Compatibility Mode" but it doesn't work for me. Please suggest what I am supposed to do.
From the screenshot it looks like you are viewing the "Watch 1" window (used for evaluating expressions and variables). What you're looking for is called the "Locals" window. You can find it using the menus Debug -> Windows -> Locals while running the solution.

Why does VS2012 think my command keys are me attempting to edit code?

E.g. when I hit Ctrl-D, I for an immediate window, I have to move my mouse pointer out of the code window, or I get told I'm not allowed to edit code while it is running. I've only recently encountered this.
Not knowing how your Visual Studio is setup, I cannot say. However, try doing the following:
Open Visual Studio 2012 then go to Tools > Options...
In the Options menu, go to Environment > Keyboard.
From there, click inside the "Press shortcut keys:" input box and, using your keyboard, type CTRL + D. Once you do that, it will show you what command is currently using that shortcut.
Finally, type in the command name in the "Show commands containing:" input box. Click the command name from the list below, then click 'Remove'.
Hope this is what you are looking for! Let me know if you have any other questions!

Visual Studio 2010 restart debugger

In VS2008 I could start the debugger (F5) and make changes then re-start the debugger without having to completely stop debugging and then restart. I cannot find the icon or the keyboard-equivalent shortcut for this action in VS2010.
Default is Ctrl+Shift+F5, however you can remap it in Tools - Options - Environment - Keyboard. Search for Debug.Restart command. The icon looks as following in the Debug toolbar:
.
This toolbar only appears when you are in debug mode. It is actually same in VS2008.
Are you referring to 'Edit And Continue' ?
To enable it:
On the Tools menu, click Options. In the Options dialog box, open the
Debugging node, and select the Edit and Continue category. To enable,
select the Enable Edit and Continue check box. To disable, clear the
check box.
Note that if you're using a 64 bit PC, you will have to explicitly set the platform target to x86 instead of Any CPU as Edit And Continue isn't available on 64 bit machines.
I allways do it with ctrl+shift+f5, I don't know if it's another way to do it

Lost window in visual studio 2010

I am new and stupid. I closed this window:
How this window is called and how to activate it. Make it pop up.
It is the Locals window.
You will find it under Debug -> Windows.
Alternatively, use the keyboard shortcut Ctrl + D + L.
It is only available during a debugging session and is not available on Express editions.
Go to the Debug menu then windows then locals and it will show up. You must be in the middle of debugging to have it show in the list.
The Locals window comes up with you start debugging (hit F5). If you need it back, go to Debug > Windows > Locals while debugging.
Note, you can also get it back if you click Windows > Reset Window Layout (which I've had to use on occasion when windows get really messed up!) Be warned that this will erase any changes you've made to the layout. But sometimes it is worth it!

How can I disable ReSharper in Visual Studio and enable it again?

I installed ReSharper, and it works in Visual Studio, but how can I disable it?
Whenever I search in the ReSharper menu, I can't find a disable option.
You can disable ReSharper 5 and newer versions by using the Suspend Now button in menu Tools → Options → ReSharper.
If you want to do it without clicking too much, open the Command Window (Ctrl + W, A) and type:
ReSharper_Suspend or ReSharper_Resume depending on what you want.
Or you can even set a keyboard shortcut for this purpose. In Visual Studio, go to Tools -> Options -> Environment -> Keyboard.
There you can assign a keyboard shortcut to ReSharper_Suspend and ReSharper_Resume.
The Command Window can also be opened with Ctrl + Alt + A, just in case you're in the editor.
Bind ReSharper_ToggleSuspended to a shortcut key.
Steps:
Tools>Options
Click Keyboard on the left hand side
Type "suspend" in the "Show commands containing:" input box
Pick the "ReSharper_ToggleSuspended"
Press shortcut keys: and
Press the "Assign" button.
Binding ReSharper_ToggleSuspended to a shortcut key (in my case: Ctrl-Shift-Q) works very well. With ReSharper not supporting the async CTP yet (as of mid-2011), when dipping into the code the uses the async keyword, this shortcut is invaluable.
I always forget how to do this and this is the top result on Google. IMO, none of the answers here are satisfactory.
So the next time I search this and to help others, here's how to do it and what the button looks like to toggle it:
Make sure Resharper is currently enabled or the commands may fail.
Open package manager console via the Quick Launch bar near the caption buttons to launch a PowerShell instance.
Enter the code below into the Package Manager Console Powershell instance:
If you want to add it to the standard toolbar:
$cmdBar = $dte.CommandBars.Item("Standard")
$cmd = $dte.Commands.Item("ReSharper_ToggleSuspended")
$ctrl = $cmd.AddControl($cmdBar, $cmdBar.Controls.Count+1)
$ctrl.Caption = "R#"
If you want to add it to a new custom toolbar:
$toolbarType = [EnvDTE.vsCommandBarType]::vsCommandBarTypeToolbar
$cmdBar = $dte.Commands.AddCommandBar("Resharper", $toolbarType)
$cmd = $dte.Commands.Item("ReSharper_ToggleSuspended")
$ctrl = $cmd.AddControl($cmdBar, $cmdBar.Controls.Count+1)
$ctrl.Caption = "R#"
If you mess up and need to start over, remove it with:
$ctrl.Delete($cmdBar)
$dte.Commands.RemoveCommandBar($cmdBar)
In addition to adding the button, you may wish to add the keyboard shortcut
ctrl+shift+Num -, ctrl+shift+Num - that is: ctrl+shift+-+-
EDIT:
Looks like StingyJack found the original post I found long ago. It never shows up when I do a google search for this
https://stackoverflow.com/a/41792417/16391
If resharper is completely missing from the options menu, it could be because the extension itself has been disabled.
In Visual Studio 2017 ReSharper 2018.X.X can be enabled and disabled by going to Help > Manage Visual Studio Performance. Then select JetBrains ReSharper ... under Extensions.
In Visual Studio 2019, you would go under Extensions->Manage Extensions->Installed
You can add a menu item to toggle ReSharper if you don't want to use the command window or a shortcut key. Sadly the ReSharper_ToggleSuspended command can't be directly added to a menu (there's an open issue on that), but it's easy enough to work around:
Create a macro like this:
Sub ToggleResharper()
DTE.ExecuteCommand("ReSharper_ToggleSuspended")
End Sub
Then add a menu item to run that macro:
Tools | Customize...
Choose the Commands tab
Choose the menu you want to put the item on
Click Add Command...
In the list on the left, choose "Macros"
In the resulting list on the right, choose the macro
Click OK
Highlight your new command in the list and click Modify Selection... to set the menu item text etc.
You need to goto Tools-->Options--->Select Resharper--->Click on suspend now,to disable it
Now Resharper supports Suspend & Resume argument at devenv.exe
(ReSharper 2019.2.3)
Run VS & Suspend R#:
devenv.exe /ReSharper.Suspend
Run VS & Resume R#:
devenv.exe /ReSharper.Resume
Here's an example usage:
In case the solution did not help to just suspend resharper (STRG+R, STRG+R did still not work for example) I decided to disable the plugin and restart visual studio.
VisualStudio > Extras > Extensions > Resharper > Disable
https://learn.microsoft.com/en-us/visualstudio/extensibility/how-to-diagnose-extension-performance
In ReSharper 8:
Tools -> Options -> ReSharper -> Suspend Now
For ReSharper 2017.2.2, go to ReSharper | Options | Product and features.
Tools -> Options -> ReSharper (Tick "Show All setting" if ReSharper option not available ). Then you can do Suspend or Resume. Hope it helps (I tested only in VS2005)
Very simple steps:
Go to Extensions → Manage Extensions
Click on Installed section at the top left and search for "resharper"
You will see disable button over the extension, click to it then restart Visual Studio and that's it!

Resources