Visual Studio 2013 - F10 / F11 stopped working on upgrade? - vb.net

I just upgraded my Visual Studio from 2012 to 2013 and haven't done anything else yet short of installing all the updates recommended.
For whatever reason, when I go into my solution and press F10 or F11, it runs the entire program as if I had pressed F5... F8 works the way F10 used to, but I don't know why the keys I've always used now don't.
I set up visual studio as a VB environment.
How can I fix this?
Thanks!!!
Additional Info:
Just to add on as much information as I can, if I set a breakpoint in my code, then I can use F10 / F11 to continue stepping through my code once the breakpoint is hit and execution is stopped as would be expected.
EDIT 2013-12-31:
Based upon a comment made by Neolisk, it appears this is simply a change in default behavior in Visual Studio 2013... If anyone knows how to change this back to the way it was in 2012, that would be GREATLY appreciated, but at least I now know it's not an error / installation issue.

If 2013 works the same as previous versions, then do the following:
Navigate to Tools > Import and Export Settings
Choose "Import selected environment settings"
On the next screen, choose to save your current setings if you want to.
When you get to the point where you can import, just select "General Development Settings"
That should set everything back to what you're probably used to. Most people are set up using general settings and either don't realize it or just forget.
EDIT: If your issue is that the program executes when you press F10 or F11 when you are not debugging, then I think you might be out of luck. It's done that to me personally since VS 2008 (I'll frequently miss the F12 key when I'm in a hurry), and, after some searching, I think it actually happens to everyone:
Visual Studio - Prevent F11 from starting the debugger?
My guess is that this is a side-effect of not being able to set contextual hot keys based on whether you are or are not debugging. Since F10 and F11 are tied to debug-execution-related operations, my guess is that Visual Studio realizes that it needs to be debugging to process them, and thus starts the program.
ANOTHER EDIT: Of course, it's also possible that you had the scheme set to something else entirely in VS2012. Check out all of Visual Studio's pre-defined hotkeys by environment here: http://msdn.microsoft.com/en-us/library/da5kh0wa(v=vs.120).aspx
If none of those have the mappings that you're used to for F8, F10, or F11, then it's possible that you or an add-on may have had few custom hotkeys defined.
Worst-case scenario, you can simply redefine your shortcuts manually by key in the keyboard settings: Tools > Options > Environment > Keyboard

It sounds like you are in VB settings and not C#. You should try changing your settings to one or the other and see if those debug options change. On my machine
Tools - Import Export Settings - Reset All Settings - C# (If you want F10/F11) VB if you want F8/Shift-F8. It doesn't matter what your settings are you can still code in both languages, but if you are used to pressing F10 to debug VB.NET code you've been using C# settings this whole time. Nothing new with Visual Studio in this regard. I am using VS2013 Ultimate, have been using Visual Studio since VS2003.
The first image is VB.net, second is C# settings

You can try some of these reset settings:
And different combinations thereof, i.e. ResetToBasic first. If does not help, try ResetToC#, then back to Basic. Then try General, back to Basic. See if you can hack your way through like this.
EDIT: I tried my VS 2012, and compared to VS 2013. What you described is completely normal. VS 2012 used to step in Form_Load and similar on F10 and F11, VS 2013 no longer does it. So it seems like your VS 2013 is working as expected.

Microsoft probably has a reason to not allow to step into a property by default.
Properties are supposed to be mostly get and set and not contain a whole lot of implementation in it. But that may not be the case all the time.
If somebody is trying to step into a property that means this developer is suspecting something in that property that may be causing problems. So by default this behavior needs to be reversed and allow stepping into properties.
For now this is how you can enable stepping into properties.
Go to Tools > Options menu in Visual Studio.
Goto Debugging > General menu item in left pane.
In right view you will see and option Step over properties and operators (Managed only). Uncheck this option and then you are all set.
Enable step into properties in Visual Studio Debugger
If the above didn't work then follow this
In the Options.Keyboard page, please select "Debug.StepOver" from the command listbox, and then put focus to the "Press shortcut keys" textbox and press F10, click Assign button to re-assign shortcut, does it work?
You can also try to run Visual Studio under safe mode, which will prevents all third-party VSPackages from loading when Visual Studio starts; if the issue disappear under safe mode, you may consider checking your installed add-ons or VSPackages.
Second, to log all activity of Visual Studio to a log file for further troubleshooting, please use the /Log switch, and post the log file content here, so we can do more investigation on it.
If this feature works well before, and suddenly behave abnormally, it usually indicate that some files or configurations of Visual Studio installation is corrupted or missed, you can:
Restores Visual Studio default settings by using "Devenv.exe /ResetSettings" command. Please backup your settings before restore to default settings.
Repair/reinstall Visual Studio;
To repair Visual Studio In the Add or Remove Programs dialog box, select Visual Studio then click Change/Remove.

I found I had to run VS as Administrator to debug properly. I also do a clean solution prior to debugging, especially on x64 machines. If you put a manual debug breakpoint in the code and the IDE indicates it can't stop at that point, then it's possible that the debugger is out of sync with the source code.

An idea to test it in a short way:
Create a Hello World console app.
1 Module Module1
2
3 Sub Main()
4 Console.WriteLine("Hello")
5 End Sub
6
7 End Module
Build first.
Put the cursor in line 4 (before each step), commands should start Debug Mode if you are in Design Mode.
F10 (StepOver): Should break on line 3
F11 (StepInto): Should break on line 3
CTRL+F10 (RunToCursor): Should break on line 4
If it is working properly: Maybe the assembly which containing the entry point of your program had modified and wasn't been rebuilded, or there is somthing other problem with the point where the control expected to break.
If it doesn't work as expected on the sample, I think you should ask on MSDN FORUM or make a bug report.
I don't know why they might have intent to change this behavior.
It is working for me in my 2013 Express Edition with C# recently.

I found what I think is an acceptable workaround for the non-functioning F10/F11 Keys. They are probably the most used keys in stepping through code, and it is a real pain to click on debug and select the key from the dropdown.
I got around this shortcoming by adding icons to the toolbar for these operations.
If you are not sure how to do this, On the Debug toolbar click on the down pointing arrow near the right side of the bar. Click on Add or remove buttons.
Select Customize...
Select Add Command
Select Debug
Scroll down to the desired key (Step over / Step into)
You once clicked, you will see the two icons added at the left side
of the toolbar, Unfortunately they are the same Icon, but with a
little use, you should be able to select the right key to click on.
I actually prefer this method to trying to remember which function key
to press.

On many branded laptops, there is an extra button "Fn", Press "Fn" and "Esc" together. Functional keys will be enabled in visual studio.

Kindly press Fn key and Esc (with Lock with Fn label).
Sometimes it gets locked and Media Player buttons get activated.

Sounds stupid to ask but what type of keyboard do you have? I know some keyboards have different modes that allow you to set different profiles for keys based upon the application. I use the feature with my Microsoft Natural keyboard. However I have had problems with the profile still being active when I switch into Visual Studio and then F10, etc doesn't work correctly.

I faced the problem that F10/F11 doesn't work but the breakpoint works.
Once I uninstall the Security Software and unload the relevant drives it works again.
So my advice is that. And I guess it's due to the drives, so if these don't work just try to unload those questionable drives may connected with this question.

Using Logitech MX 3000 Keyboard, I've upgraded to the last setpoint version and these keys work now perfectly. (Driver version 5.90.41)

Related

How to google from the context menu of the Visual Studio 2015 code editor

how can I modify Visual Studio 2015 to be able to search the internet (my fav search engine happens to be google) from the context menu in the code editor?
Ideally, I would like it to open as a new tab in my (default) external browser, because the internal web browser is still...lacking, shall we say?
I found one extension "web search" for older VS, but I have found no extension that works with VS 2015. I found no article that still works.
For comparison, when you're in Chrome, you can select some text, right click and say Search Google for 'what you selected'.
I think this would be handy when learning new technologies from a project that uses those technologies, or just for help.
Ok this turned out to be fairly easy. I just added a tool to Tools, External Tools
Command: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
Arguments: https://www.google.com/?gws_rd=ssl#newwindow=1&safe=active&q=%22$(CurText)%22
I enclosed the $(CurText) variable around quotes (%22) so that it would search on the exact phrase.
Then, to make it more accessible and actually put it in the context menu (and other places), I clicked the Move Up button to make it the first command, then customized the Standard toolbar to include Tools.External Command 1. I also added it to Other Context Menus | Html Context and Editor Context Menus | Code Window
Then I also went into Tools, Options, Keyboard and associated Tools.ExternalCommand1 with Alt+G
IMPORTANT: Because Visual Studio (still, in 2015) doesn't save some modifications to the IDE until it shuts down, you need to shut down all other instances of VS and then lastly shut down the instance that you used to enact these IDE modifications for them to "stick". And, if VS 2015 is like previous versions, be prepared for the menu / toolbar modifications to simply go away one day, at which point you'll just have to redo them.

Visual Studio 2013 VB intellisense

Apologies upfront if this is a silly question, but it's annoying me to no end and I can't figure it out.
I'm using Visual Studio 2013 Professional, and I usually code in C# where when using the Intellisense, when I press Enter to select a method or something it adds my selection and I can continue typing on the same line.
But at the moment I'm working on a project which is in VB.NET, and when I use the Intellisense in the same way it puts my cursor in the next line, i.e. I press Enter to select whatever, it adds my selection and starts a new line, so I have to press the Backspace to go back to the previous line. It's so annoying!
Is there a way to change this behaviour so the cursor doesn't go to the next line? I've looked at the settings available in Tools > Options but can't figure it out, and searching Google for anything similar hasn't been successful.
Found it here (paragraph List Members)
You have toggled to suggestion mode instead of completion mode.
You can also change to suggestion mode, in which only the text you type is inserted into the code. For example, if you enter an identifier that is not in the list and press TAB, in completion mode the entry would replace the typed identifier. To toggle between completion mode and suggestion mode, press CTRL+ALT+SPACEBAR or click Edit/IntelliSense/Toggle Completion Mode.
So, either use TAB/SPACEBAR (as I said in the comment) or press CTRL+ALT+SPACEBAR to switch back to completion mode.
EDIT: I've found out that whenever you type Stri (String will show highlighted in the list now) and you press . (dot) it will autocomplete and stay at the same line.
I think your way of doing this in C# isn't possible in Visual Basic.
I had the same problem and discovered that Auto list members was not enabled on my machine. It's under Tools > Options > Text Editor > Basic > General. This gave me the intellisense I was looking for.
Simple thing which can be used when you face this kind of issue is to press
tab key instead of Enter key when the IntelliSense provided me prediction list.

Move line Up/Down shortcut in Visual Studio 2012

In VS2010 I had a shortcut set up Alt+Up/Down to move lines of code up or down, just like I used to have in Eclipse in my Java days.
Now since Power Tools and macros (which is how I set up this shortcut in VS2010) are not available in VS2012, how do I get this to work?
I've seen somebody mentioned that Resharper can do this, but for the love of fire and water, I can't find the command names in the list of commands that can do that.
I have tried ReSharper_MoveUp/MoveDown and that does not move lines up/down:
This moves blocks of text up and down. I just want line-by-line up or down, no fancy logic there.
Before
After ALT+Up (when cursor is on WriteLine line) I would like to see this:
I have seen these threads: What's the equivalent for eclipse's ALT+UP/DOWN (move line) in Visual Studio?, Visual Studio: hotkeys to move line up/down and move through recent changes, but none of the suggested solutions work in VS2012.
Any other ideas?
UPD 7 Nov 2012: . Extensions are catching up with Visual Studio 2012. Now I know at least 3 extensions that provide this functionality:
MoveLine Extension. Link provided by Carl G
Move Line Extension with modifications to 2010 version. By gius
Productivity Power Tools 2012. Have not actually tried this, but this blog post states it does the line move up/down
UPD 15 Nov 2012: Just stumbled across another extension that claims it does what is required here. Have not tried it though: LineMan Extension
UPD 10 May 2015 Just installed VS2015 RC and this is built-in already:
For those who arrived on this question using Visual Studio 2013 or above, the feature is built right into the program. Just use AltUp and AltDown to move the line with your cursor—or the selected lines—up and down.
If you wish to rebind it in Tools > Options > Environment > Keyboard, the keys are Edit.MoveSelectedLinesUp and Edit.MoveSelectedLinesDown. You may need to remove your new combination from other existing keys first.
Update: huzzah, Productivity PowerTools VS2012 is now available and offers this functionality (along with another personal favorite, Tools.AddEndTokenAtTheEnd.)
MoveLine Extension (compatible with VS 2012; I had to manually restart my VS in order to see the commands in VS's keyboard shortcut tool.)
Install ReSharper.
Open Tools -> Options -> Environment -> Keyboard (as shown in a picture)
Find "ReSharper.ReSharper_MoveUp"
In "Use new shortcut in:" choose: "Text Editor"
Click in "Press shortcut keys:" and press your shortcut (for example Alt+ArrowUp)
Press "Assign" button
Same with with "ReSharper.ReSharper_MoveDown"
P.S. Works fine for single lines and multiple selected lines, but removes selection after moved 1 line. Hope there are way to move multiple lines multiple times in one selection.
If you have Resharper, then you can hit Ctrl + Shift + Alt + ↑ to move the current line up. or Ctrl + Shift + Alt + ↓ to move one line down.
This works in VS 2012 Premium with Visual Studio keyboard scheme in Resharper 7 (7.0.97.60 to
be precise).
Edit: This is mapped to 'ReSharper.ReSharper_MoveUp'/'MoveDown' commands.
In Visual Studio 2017(atleast) I have below
You can use Move Line Command extension.
Just follow formula349's comment:
I was able to get this working with 2012 as-is.
Rename the package to .zip and unzip all files into a folder. Edit the extension.vsixmanifest file and look for the SupportedProducts XML node. Change the Version="10.0" to Version="11.0".
Re-zip the folder contents and rename back to .vsix. Works great!
While a lot of people seem to be recommending misc. Visual Studio Extensions and Resharper, I would like to point out there is a native hotkey that accomplishes this goal. I came to this question trying to find the answer, as my Resharper replaced my default hotkeys with their MoveUp and MoveDown versions.
And while Resharper's hotkeys do move things up and down, they are not what the original poster are looking for, and they are not what I wanted. These hotkeys move methods and blocks of code, not individual lines.
Visual studio has two hotkey commands to move your selected lines upwards or downwards.
These hotkeys are:
Edit.MoveSelectedLinesDown
Edit.MoveSelectedLinesUp
I am using Visual Studio 2013 however, so I am unaware if these exist in an older version. If 2012 does not have these hotkeys then perhaps an extension is the only solution.
Either way, I had an issue locating the exact hotkey within visual studio's list and it took me a good while to find these, so I hope that my solution manages to help someone else in a similar situation to my own.
Shift+Del and then Ctrl+V
Shift+Del does the cut (same as Ctrl+X) operation on the current line on which cursor is positioned.
Then you can use Ctrl+V to paste it at any place you like.
Good thing is that you don't need to select the complete current line, just the cursor needs to be positioned on the line.
One downside to using this shortcut is that you won't be able to see the line moving ( up or down ) lively in front of your eyes.
ReSharper's move up and move down shortcuts are smart - instead of just moving the current line (which can easily result in broken code), it will move the current statement up and down in the list of statements that make up the method body. This is much more powerful than just moving a single line of code.
But this doesn't help you get your statement inside the if block. Here you need to do one of two things.
Firstly, move the statement above the if block, then use Ctrl+Shift+Alt+Right to push it down in scope. The statement will now be inside the if block, and you can use up and down to move it around in there. You can also use Ctrl+Shift+Alt+Left to pull it up in scope, outside of the if block.
Alternatively, you can put the text caret on the outside of the closing brace of the if block and use Ctrl+Shift+Alt+Down to move the brace down, stepping over following statements, including them inside the if block.
These keys can do a lot more than just move a single statement. If you put the text caret on a method or class declaration, Up and Down will move the entire method or class declaration up and down. If you put the text caret in the parameter list of a method, Left and Right will rearrange individual parameters (and then Alt+Enter can invoke the Change Signature refactoring).
More details in the help pages.

How do you prevent Visual Studio from switching to the Code Analysis tab after each build?

After each build, Visual Studio 2012 switches from the Solution Explorer to the Code Analysis tab, usually with the yellow "No code analysis issues were detected." (Might as well say "TA DA!").
Is there an option to turn off the tab switching (keeping it on Solution Explorer)? [because I can't find it either in Solutions or Options].
Thanks!
VS 2012
The best answer I have found so far is to drag the Code Analysis view's tab away from the Solution explorer. I've docked mine below the Solution explorer and made it about 1 inch high - so I can still see what it is reporting on the rare occasions when I wish to check it, but without losing my Solution Explorer all the time.
It's still unnecessary but a lot less irritating.
Update - VS 2013
In VS 2013 you can now click the Settings option in the Code Analysis view, and disable the Show window when issues are detected option.
Right Click Project --> Properties --> Code Analysis Tab --> Uncheck Enable Code Analysis on Build.
Hope that Helps.
Just found very helpful blog post about your issue Temporarily disable the C# static code analysis for a whole VS instance.
Also I have found way to permanently disable Code Analysis for all VS 2012 instances:
You need to add Windows environment variable with name "DevDivCodeAnalysisRunType" and value "Disabled" (all without quotes). There is helpful post about Windows environment variables How To Add/Edit Environment Variables in Windows 7.
Hope that helps.

Disabling Intellisense Auto Line Return [duplicate]

When editing C# code in Visual Studio 2010, the ENTER key makes IntelliSense complete the current suggestion, without adding a new line.
In VB.NET, the default IntelliSense behavior for the ENTER key is to add a new line after completing the current suggestion.
How can I configure IntelliSense to change the VB.NET behavior to the C# one?
I already know that I could press TAB or SPACE, but out of habit I always end up hitting ENTER (and changing line).
UPDATE VISUAL STUDIO 2017:
Now with Visual Studio 2017 you can change it. Tools -> Options -> Text Editor -> Basic -> IntelliSense.
In Enter key behavior select Never add new line on enter
ANSWER FOR VISUAL STUDIO 2015 AND PREVIOUS:
If you want to avoid inserting new line on enter with autocomplete suggestion, just don't press enter. Instead of Enter press Space bar which completes your autofill and just inserts a space.
Or you may use this third party app:
Resharper makes it possible overriding Visual Studio intellisense and using its own intellisense. It is the only way I've found.
It has a 30 days free trial if you want to test it.
Unfortunately the set of trigger keys for intellisense completion is not a configurable item for VB.Net. There is no way in the default Visual Studio environment to change this behavior.
It would be possible to develop a plugin of sorts to accomplish this. However that's a pretty extreme measure.
EDIT
As of Visual Studio 2017, it is now possible to change this. See the answer below