提交 45f03cc2 编写于 作者: C CyrusNajmabadi 提交者: GitHub

Merge pull request #17904 from dotnet/merges/dev15.1.x-to-master-20170316-070003

Merge dev15.1.x to master
......@@ -169,6 +169,37 @@ public async Task TestRemoteHostSynchronizeIncrementalUpdate()
}
}
[Fact, Trait(Traits.Feature, Traits.Features.RemoteHost)]
public void TestRemoteWorkspaceCircularReferences()
{
using (var tempRoot = new Microsoft.CodeAnalysis.Test.Utilities.TempRoot())
{
var file = tempRoot.CreateDirectory().CreateFile("p1.dll");
file.CopyContentFrom(typeof(object).Assembly.Location);
var p1 = ProjectId.CreateNewId();
var p2 = ProjectId.CreateNewId();
var solutionInfo = SolutionInfo.Create(
SolutionId.CreateNewId(), VersionStamp.Create(), "",
new[]
{
ProjectInfo.Create(
p1, VersionStamp.Create(), "p1", "p1", LanguageNames.CSharp, outputFilePath: file.Path,
projectReferences: new [] { new ProjectReference(p2) }),
ProjectInfo.Create(
p2, VersionStamp.Create(), "p2", "p2", LanguageNames.CSharp,
metadataReferences: new [] { MetadataReference.CreateFromFile(file.Path) })
});
var remoteWorkspace = new RemoteWorkspace(workspaceKind: "test");
// this shouldn't throw exception
var solution = remoteWorkspace.AddSolution(solutionInfo);
Assert.NotNull(solution);
}
}
private static async Task<Solution> VerifyIncrementalUpdatesAsync(InProcRemoteHostClient client, Solution solution, string csAddition, string vbAddition)
{
Assert.True(PrimaryWorkspace.Workspace is RemoteWorkspace);
......
......@@ -36,6 +36,12 @@ protected override void Dispose(bool finalize)
_registrationService?.Unregister(this);
}
// constructor for testing
public RemoteWorkspace(string workspaceKind)
: base(RoslynServices.HostServices, workspaceKind: workspaceKind)
{
}
// this workspace doesn't allow modification by calling TryApplyChanges.
// consumer of solution is still free to fork solution as they want, they just can't apply those changes
// back to primary workspace. only solution service can update primary workspace
......@@ -68,7 +74,6 @@ public Solution AddSolution(SolutionInfo solutionInfo)
lock (_gate)
{
this.OnSolutionAdded(solutionInfo);
this.UpdateReferencesAfterAdd();
return this.CurrentSolution;
}
......@@ -92,8 +97,6 @@ public Solution UpdateSolution(Solution solution)
var newSolution = this.SetCurrentSolution(solution);
this.RaiseWorkspaceChangedEventAsync(WorkspaceChangeKind.SolutionChanged, oldSolution, newSolution);
this.UpdateReferencesAfterAdd();
return this.CurrentSolution;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册