-
Notifications
You must be signed in to change notification settings - Fork 783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inline Rename and Find all References fail across projects #3033
Comments
Were all documents saved to disk? If not, it's a known bug - FCS reads all files from disk, except current one. |
I've tested it on #3025 and found that it does not fix this bug. |
I debugged it seems that |
Thanks for the investigating work @vasily-kirichenko |
From @vasily-kirichenko:
|
Adding project reference raises NRE: Stack trace:
|
After that |
@Pilchie could you take a look at https://github.com/Microsoft/visualfsharp/blob/master/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs#L420 for us? What are we doing wrong here to get a stack like the above?
|
It looks like what's happening is that you're adding a project reference to a project which has itself not been added to the @jasonmalinowski any thoughts? |
@Pilchie Ugh, yes, all we've done is create a project ID. Likely we should do this:
rather than
|
@Pilchie @cartermp @vasily-kirichenko Here's that potential fix if you get to give it a go on the repro and other cases #3387 |
#3387 seems to fix "Find all references", but not Inline Rename. |
But loading VFT solution raises this assert (twice): Assertion Failed: Abort=Quit, Retry=Debug, Ignore=ContinueCould not retrive referenced project guidproject file at Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectReferenceNode..ctor(ProjectNode root, ProjectElement element) at Microsoft.VisualStudio.FSharp.ProjectSystem.FSharpProjectReferenceNode..ctor(ProjectNode root, ProjectElement element) at Microsoft.VisualStudio.FSharp.ProjectSystem.FSharpReferenceContainerNode.CreateProjectReferenceNode(ProjectElement element) at Microsoft.VisualStudio.FSharp.ProjectSystem.ReferenceContainerNode.CreateReferenceNode(String referenceType, ProjectElement element, BuildResult buildResult) at Microsoft.VisualStudio.FSharp.ProjectSystem.ReferenceContainerNode.LoadReferencesFromBuildProject(Project buildProject) at Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectNode.ProcessReferences() at Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectNode.Reload() at Microsoft.VisualStudio.FSharp.ProjectSystem.FSharpProjectNode.Reload() at Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectNode....... --------------------------- Abort Retry Ignore --------------------------- |
@cartermp I can confirm this is not fixed in latest nightly for the case where you create a project and library and then rename. I can confirm it does work for the case where you restart VS, i.e. the solution and project are already created. The underlying bug feels like it must either be
I suppose the problem is likely to be that, in the incremental case, That's also partially confirmed by the fact the unload/reload project is now a workaround |
Here's my analysis - @KevinRansom, @brettfo, @Pilchie please read. I will submit the content below as documentation, but I really need you guys to fully understand how this code works and fix the bugs in it, to make sure we don't have any further massive snafus :) In LanguageService.fs we are trying to keep several versions of project information in sync. Here's how I believe this works:
So one fix might be to call However, looking at the Roslyn CPS project code, it seems to me that Roslyn's CPSProject/AbstractProject implementation is probably meant to convert the metadata references managed by |
Good analysis @dsyme. I think it's worth checking to see what happens in the project conversion - it is tied to the output path of the projects, and only does the conversion if the incoming metadata reference path matches a project's output path. This is doubly complicated by the fact that most projects actually have two output paths. The compiler is generally told to build to the For reference: the split between Also tagging @jasonmalinowski. |
@Pilchie Thanks, great. Yes, it's possible they aren't. We need to debug into the roslyn code to be sure |
This is now fixed as of 15.6 Preview 1.1. I suspect that the work @KevinRansom did in the relevant files ( |
Inline Rename and Find all References fail across projects in cases where you have made incremental updates to the references between projects.
Workaround is to unload/reload your solution.
Repro steps
Provide the steps required to reproduce the problem
Create a Console App and Class Library.
Create anything in the Class Library (class, function, etc.), and use it in the Console app.
In the Class Library, rename a construct that is used in the Console App. Or find all references on it.
Expected behavior
In either case, the action works across projects.
Actual behavior
It fails.
Known workarounds
Unload/reload solution or individual projects after making a change to project references
Related information
VS 15.2 and 15.3. Not fixed with nightlies.
Interestingly enough, Go to Definition and the Go to All features all work perfectly across projects.
Screen captures from @vasily-kirichenko:
Inline Rename:
Find all References:
The text was updated successfully, but these errors were encountered: