visual studio 2012 c# go to definition always returns metadata

2.8k views Asked by At

ide: vs 2012 v11.0.60610.01 update 3 project: web site, mix of vb and c# problem: vb navigates to definition, c# navigates to metadata complaint: complete pain in the ass when managing a 30k code-line project. solution: you be the first to figure this out, it's beyond my level of patience.

i find metadata to be 110% useless. is there ANY way to get c# to navigate to the actual definition like vb does?

thanks

3

There are 3 answers

7
wilso132 On

If it's navigating to the metadata, rather than the definition, it probably has to do with how your assemblies were added. If you add a reference as a DLL, it will always show metadata, even if that project is included in your solution; you have to add a reference by project to have access to the source.

1
NDJ On

"i find metadata to be 110% useless. is there ANY way to get c# to navigate to the actual definition like vb does?"

Resharper's go to definition/go to implementation options work exactly as you'd expect - worth trying it to see if it fixes your issue.

This question might be of help if you choose not to try resharper

0
Peter Jaffe On

I realize this is an old thread, but it seemed to be one of the few that focused on the role of mixed languages (C# and VB.NET) as a contributing factor to this.

I ran a few tests across VS.NET 2010, 2012, 2013, and 2015. My empirical results (not validated by any official Microsoft documentation) is that all 4 support Find All References of VB.NET members consumed by C# (albeit, split into apparently separate result groups), as long as project references were added. However, VS.NET 2010, 2012 and 2013 end up in the "from metadata" view for Go To Definition from the C# code to a VB.NET member. Where as VS.NET 2015 appears to have this cross-language Go To Definition navigation working correctly.

I also confirmed that using Resharper's support for External Sources does allow Go To Definition to work under VS.NET 2012, and that almost motivated me to purchase licenses for Resharper for our current project that has mixed C# and VB.NET projects, but now my plan is just to expedite adopting VS.NET 2015.