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
                remoteWorkspace.TryAddSolutionIfPossible(solutionInfo, workspaceVersion: 1, out var solution);
                Assert.NotNull(solution);
            }
        }
Example #2
0
        private static async Task <SolutionService> GetSolutionServiceAsync(Solution solution, Dictionary <Checksum, object> map = null)
        {
            // make sure checksum is calculated
            await solution.State.GetChecksumAsync(CancellationToken.None);

            map = map ?? new Dictionary <Checksum, object>();
            await solution.AppendAssetMapAsync(map, CancellationToken.None);

            var sessionId       = 0;
            var storage         = new AssetStorage();
            var source          = new TestAssetSource(storage, map);
            var remoteWorkspace = new RemoteWorkspace();
            var service         = new SolutionService(new AssetService(sessionId, storage, remoteWorkspace.Services.GetService <ISerializerService>()));

            return(service);
        }
Example #3
0
 private static Solution WithChangedOptionsFromRemoteWorkspace(Solution solution, RemoteWorkspace remoteWorkpace)
 => solution.WithChangedOptionsFrom(remoteWorkpace.Options);
Example #4
0
 public TestAccessor(RemoteWorkspace remoteWorkspace)
 {
     _remoteWorkspace = remoteWorkspace;
 }