Open bjorkstromm opened 6 years ago
Looks like this should be open in the Roslyn repo instead though? I think we could put together a simple repro that is completely independent of anything OmniSharp specific. Seems like a variant of this https://github.com/dotnet/roslyn/issues/20040
Actually I am pretty sure this used to work when script references were added manually as project references in the project model. We went away from that as it had a bunch of other problems, but perhaps we can be a bit smarter about what is happening when the resolver is plugged in and how script references are incorporated into the workspace.
Tried reproducing using unit test by adding this test to RenameFacts.cs
:
[Fact]
public async Task Rename_UpdatesMultipleCsxDocumentsIfNecessary()
{
const string code1 = "public class Foo {}";
const string code2 = @"
#load ""test1.csx""
var foo = new F$$oo();";
var testFiles = new[]
{
new TestFile("test1.csx", code1),
new TestFile("test2.csx", code2)
};
using (var host = CreateOmniSharpHost(testFiles))
{
var result = await PerformRename(host, testFiles, "xxx", wantsTextChanges: true, applyTextChanges: false);
var changes = result.Changes.ToArray();
Assert.Equal(2, changes.Length);
}
}
However, I'm unable to reproduce this exact error. But what I'm seeing is that RenameService
can't find the symbol here.
@filipw
when script references were added manually as project references in the project model.
Did /findusages
also work then? In this case test1.csx
would find than test2.csx
uses Foo
?
We went away from that as it had a bunch of other problems, but perhaps we can be a bit smarter about what is happening...
When/if .cake
moves towards "roslyn-style-load" and skips current "flat-file" approach, I would be keen on having references between script files. Would be happy to help where needed.
OmniSharp-VSCode: 1.15.2 OmniSharp-Roslyn: 1.31.2-beta.73
Rename symbol, which should rename in loaded
.csx
throwsNullReferenceException
Steps to reproduce:
Add following files test1.csx
test2.csx
Foo
intest2.csx
Stacktrace