Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I got error when press F12 Go to definition in Visual Studio 2015 / C#

When I press F12 (Go To Definition) in Visual Studio 2015 I get this error message:

One or more errors occured

I already tried:

  1. Closing the solution
  2. Deleting the .suo file
  3. Re-building the solution

.. but that didn't fix it.

Please help.

like image 975
Martin Baychev Avatar asked Jul 27 '15 10:07

Martin Baychev


People also ask

How do I enable F12 in Visual Studio?

Enter Tools > Options > Environment > Keyboard and press the Reset button. Click OK to save changes. Then enter in Resharper > Options > Environment > Keyboards & Menus. Select Visual Studio and then press Apply Scheme button.

Why is Ctrl F12 not working Visual Studio?

Go to Tools -> Options -> Keyboard, Reset all settings. Restart your visual studio and then try to use F12.

How do I enable definition in Visual Studio?

Go To Definition If you are a keyboard user, place your text cursor somewhere inside the symbol name and press F12. If you are a mouse user, either select Go To Definition from the right-click menu or use the Ctrl-click functionality described in the following section.

How do I peek at a definition in Visual Studio 2017?

Peek Definition. If you are a keyboard user, place your text cursor somewhere inside the type or member name and press Alt + F12. If you are a mouse user, you can select Peek Definition from the context menu. In Visual Studio 2017 version 15.4 and later, there is a new way to peek view a definition by using the mouse.

How do I view decompiled source code in Visual Studio Code?

You can set an option to see decompiled source code when you view the definition of a C# type or member whose source code is unavailable. To turn on this feature, choose Tools > Options from the menu bar. Then, expand Text Editor > C# > Advanced, and select Enable navigation to decompiled sources.

What happens if the source code is not available?

If the source code is not available, metadata is displayed instead. The Go To Definition feature navigates to the source of a type or member, and opens the result in a new tab.

How to quickly jump between files in Visual Studio Code?

However, when you are working on a task, you will find yourself quickly jumping between the same set of files. VS Code provides two powerful commands to navigate in and across files with easy-to-use key bindings. Hold Ctrl and press Tab to view a list of all files open in an editor group.


1 Answers

This is an issue with C# and tabs instead of spaces when attempting to hit the metadata of an external assembly. It may be related the inferred position of the insertion point.

enter image description here

Others have documented this

There are a couple of Connect tickets here and here and a Github issue on this. There is also a discussion here.

Visual Studio 2015 Update 1

This issue is addressed in Update 1 so please install!

Poor workaround for RTM

The options dialog remembers the last page and remains there on subsequent opens. I have a keyboard shortcut to open the options pane quickly (Alt + o). I am temporarily changing to spaces, going to definition and then reverting to tabs before making any code changes. This workflow isn't pretty but neither were the 3.0 Nuget issues in VS2015 either (Nuget 3 has improved to date).

like image 108
Adam Caviness Avatar answered Sep 18 '22 07:09

Adam Caviness