ramnz
ramnz

Reputation: 631

go to definition in VS 2010

what do I have to do to jump to the right class not the metadata?

in visual studio 2010 while working on c# code I right click on some code to jump to "Go To Definition" sometimes shows the right class where my object is define and sometimes show me the Metadata not the right class...

why is this ?

thanks for your help

Upvotes: 1

Views: 2066

Answers (4)

Will Vousden
Will Vousden

Reputation: 33358

As others have said, Visual Studio cannot show you the actual source code for an assembly that you only have in compiled form (i.e. .exe or .dll). If you really need to see how something was implemented, then you can use Reflector to decompile it for you, though the resulting code will probably be less intelligible than the original (no comments, variable names will be lost, etc.).

Upvotes: 1

TalentTuner
TalentTuner

Reputation: 17556

if you added references to other project than F12 will go to the actual source code but for the DLL it will go to the meta data if defind

Upvotes: 3

Oded
Oded

Reputation: 498972

Visual Studio will go to the metadata when the reference is a DLL or an EXE - it doesn't "know" about the source code.

It will go to the source code when you have references a project.

Upvotes: 1

Dan J
Dan J

Reputation: 16708

It only shows you the source code of a class if that class is available in your solution. If you're referencing a project whose source you have, you can add it to the solution as a project reference, and "Go To Definition" should behave as you'd expect. If you're referencing a compiled DLL, "Go To Definition" will only display metadata.

Upvotes: 8

Related Questions