The behavior of “Goto Definition” action of Blueprint Editor is broken. If C++ UE project is run from Visual Studio then “Goto Difinition” action trying to open another instance of Visual Studio instead of using instance from which UE project is run. Moreover, the newly opened Visual Studio still failed to show the proper place of requested function definition. Because of that “Goto Definition” is broken completely in UE 4.18.0
UE version: Version: 4.18.0-3709383+++UE4+Release-4.18
Steps to reproduce:
- Create C++ UE project (on the same disk where UE installed, see below)
- Open project in Visual Studio
- Run project from Visual Studio
- Create any Blueprint, add any native node to it and issue “Goto Definition” action on that native node
Expected behavior: Visual Studio window from which project is run became active and go to foreground and show the definition of function corresponding to native BP node in question.
Observed behavior: new instance of Visual Studio started, showing error messages about browsing database and IntelliSense database are opened by another instance of Visual Studio (the one from which project is run actually). This new instance dosn’t show correct place of function definition.
Important notice: In my case the UE installed on the same disk on which I store my projects, I think it is part of problem (see technical details below)
Bug technical details:
The problem actually is incorrect implementation of AccessVisualStudioViaDTE(…) function (VisualStudioSourceCodeAccessor.cpp). And in particular is in following part of code:
if (Filename == InSolutionPath)
{
OutDTE = TempDTE;
AccessResult = EAccessVisualStudioResult::VSInstanceIsOpen;
}
The problem is: Filename is absolute path while InSolutionPath is relative. While they are point to same solution file, they are not equal as a strings (e.g. “D:\UEProjects\SomeProject\someproject.sln” and “…\…\…\…\…\UEProjects\SomeProject\someproject.sln”).
As a simplest solution, the InSolutionPath and Filename should both be converted to normalized absolute form before comparison in order to fix the issue.