Go To Definition in Visual Studio 2017 has been bugging me for a while now. When I try to Go To Definition on some types, VS2017 pops up with an error "Cannot navigate to the symbol under the caret". Today, I decided it was time to try and figure it out.
This is not the first time this has happened and there are lots of people who experienced a similar error on VS2015. Unfortunately, none of the myriad of solutions to the earlier problems solved the VS2017 issue. Workarounds I attempted include: emptying the symbol cache, cleaning the solution and recompiling, resetting the visual studio user data, disabling extensions, closing all documents, clearing various caches and temporary files. Nothing worked.
I discovered the problem only happened with generic types and that lead me to this known issue. It turns out the problem only happens when trying to navigate to a type where one or more of the generic type arguments is a user defined type. So you can Go To Definition on List<int>
, but if you try on List<MyType>
, you'll get this error: "Cannot navigate to the symbol under the caret".
Unfortunately, there is no workaround or solution at this stage. If you're using Go To Definition to access the documentation, the best option at this stage is to temporarily change types to int
, then undo.
At least a fix has already been created and now we just need to wait for this to make its way into a future update to Visual Studio.