Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

“Go To Definition” in Visual Studio only brings up the Metadata for Non-Project references

I have a C# project which contains references to assemblies in DLL format. I have the PDB information for these DLL files, contained in the same folder. When I press F12 on a referenced member, I want to go to the definition of the member. Instead, it gives me the metadata, which of course I don't want.

When VS is debugging, it does go to the source code if I single step into that method. But if I press F12 on that method, it still brings me to the metadata.

There is a similar question here, but it only applies to project references, and the accepted solution has nothing to do with my issue.

"Go To Definition" in Visual Studio only brings up the Metadata

To summarize:

  • Referenced project is a DLL
  • I have the PDB information
  • Single-stepping in debug-mode brings me to the source code
  • F12 brings me to metadata
  • I want F12 to bring me to the source code as debug does.

EDIT: Adding as a "Project" is not an option as it creates additional complexity as our solution file references about five other projects which are all under separate source control repositories.

like image 792
marknuzz Avatar asked Nov 02 '12 21:11

marknuzz


People also ask

How do I change metadata in C#?

Steps for Updating MOV Metadata in C#Load MOV file via an instance of Metadata class. Specify a predicate that will be used to filter desired metadata properties. Pass the predicate and the new value to the UpdateProperties method. Save the changes to disc in MOV format.

What is from metadata C#?

C# in metadata is defined as the binary information which is describing our program and this information is stored either in common language runtime portable executable file or in memory.


2 Answers

In Visual Studio expand the References section, select the reference to your related project (the one that contains the source code you want to F12 into) right click on it and select "Remove".

Then add the reference back to the project by right clicking on References and selecting Add Reference, under the Projects tab (if your using VS 2012) select (or browse for) the project you want to add a reference to and then click the OK button.

This will rebuild the reference and you will be able to F12 into the referenced projects source code. You will need to do this with all the projects in your solutions that are having this issue.

I don't know why this happens but at least the solution to the problem is rather simple

like image 128
mknopf Avatar answered Oct 17 '22 10:10

mknopf


If you have ReSharper installed, you should bring up ReSharper options, and look for External Sources. There you can specify the relevant options:

enter image description here

like image 31
Klas Mellbourn Avatar answered Oct 17 '22 10:10

Klas Mellbourn