예제 #1
0
            internal Task <(MonoDevelop.Projects.Solution, SolutionInfo)> CreateSolutionInfo(MonoDevelop.Projects.Solution sol, CancellationToken ct)
            {
                return(Task.Run(delegate {
                    return CreateSolutionInfoInternal(sol, ct);
                }));

                async Task <(MonoDevelop.Projects.Solution, SolutionInfo)> CreateSolutionInfoInternal(MonoDevelop.Projects.Solution solution, CancellationToken token)
                {
                    using (var timer = Counters.AnalysisTimer.BeginTiming()) {
                        projections.ClearOldProjectionList();

                        solutionData = new SolutionData();

                        var projectInfos = await CreateProjectInfos(solution.GetAllProjects(), token).ConfigureAwait(false);

                        if (IsModifiedWhileLoading(solution))
                        {
                            return(await CreateSolutionInfoInternal(solution, token).ConfigureAwait(false));
                        }

                        if (token.IsCancellationRequested)
                        {
                            return(solution, null);
                        }

                        var solutionId   = GetSolutionId(solution);
                        var solutionInfo = SolutionInfo.Create(solutionId, VersionStamp.Create(), solution.FileName, projectInfos);

                        lock (addLock) {
                            if (!added)
                            {
                                added = true;
                                OnSolutionOpened(workspace, solutionInfo);
                            }
                        }
                        // Check for modified projects here after the solution has been added to the workspace
                        // in case a NuGet package restore finished after the IsModifiedWhileLoading check. This
                        // ensures the type system does not have missing references that may have been added by
                        // the restore.
                        ReloadModifiedProjects();
                        return(solution, solutionInfo);
                    }
                }
            }
            internal Task <SolutionInfo> CreateSolutionInfo(MonoDevelop.Projects.Solution sol, CancellationToken ct)
            {
                return(Task.Run(delegate {
                    return CreateSolutionInfoInternal(sol, ct);
                }));

                async Task <SolutionInfo> CreateSolutionInfoInternal(MonoDevelop.Projects.Solution solution, CancellationToken token)
                {
                    using (var timer = Counters.AnalysisTimer.BeginTiming()) {
                        projections.ClearOldProjectionList();

                        solutionData = new SolutionData();

                        var projectInfos = await CreateProjectInfos(solution.GetAllProjects(), token).ConfigureAwait(false);

                        if (IsModifiedWhileLoading(solution))
                        {
                            return(await CreateSolutionInfoInternal(solution, token).ConfigureAwait(false));
                        }

                        var solutionId   = GetSolutionId(solution);
                        var solutionInfo = SolutionInfo.Create(solutionId, VersionStamp.Create(), solution.FileName, projectInfos);

                        lock (addLock) {
                            if (!added)
                            {
                                added = true;
                                workspace.OnSolutionAdded(solutionInfo);
                                var service = (MonoDevelopPersistentStorageLocationService)workspace.Services.GetService <IPersistentStorageLocationService> ();
                                service.SetupSolution(workspace);
                                lock (workspace.generatedFiles) {
                                    foreach (var generatedFile in workspace.generatedFiles)
                                    {
                                        if (!workspace.IsDocumentOpen(generatedFile.Key.Id))
                                        {
                                            workspace.OnDocumentOpened(generatedFile.Key.Id, generatedFile.Value);
                                        }
                                    }
                                }
                            }
                        }
                        // Check for modified projects here after the solution has been added to the workspace
                        // in case a NuGet package restore finished after the IsModifiedWhileLoading check. This
                        // ensures the type system does not have missing references that may have been added by
                        // the restore.
                        ReloadModifiedProjects();
                        return(solutionInfo);
                    }
                }
            }
예제 #3
0
            internal Task <SolutionInfo> CreateSolutionInfo(MonoDevelop.Projects.Solution sol, CancellationToken ct)
            {
                return(Task.Run(delegate {
                    return CreateSolutionInfoInternal(sol, ct);
                }));

                async Task <SolutionInfo> CreateSolutionInfoInternal(MonoDevelop.Projects.Solution solution, CancellationToken token)
                {
                    using (var timer = Counters.AnalysisTimer.BeginTiming()) {
                        projections.ClearOldProjectionList();

                        solutionData = new SolutionData();

                        var projectInfos = await CreateProjectInfos(solution.GetAllProjects(), token).ConfigureAwait(false);

                        if (IsModifiedWhileLoading(solution))
                        {
                            return(await CreateSolutionInfoInternal(solution, token).ConfigureAwait(false));
                        }

                        var solutionId   = GetSolutionId(solution);
                        var solutionInfo = SolutionInfo.Create(solutionId, VersionStamp.Create(), solution.FileName, projectInfos);

                        lock (addLock) {
                            if (!added)
                            {
                                added              = true;
                                solution.Modified += OnSolutionModified;
                                NotifySolutionModified(solution, solutionId, workspace);
                                workspace.OnSolutionAdded(solutionInfo);
                                lock (workspace.generatedFiles) {
                                    foreach (var generatedFile in workspace.generatedFiles)
                                    {
                                        if (!workspace.IsDocumentOpen(generatedFile.Key.Id))
                                        {
                                            workspace.OnDocumentOpened(generatedFile.Key.Id, generatedFile.Value);
                                        }
                                    }
                                }
                            }
                        }
                        return(solutionInfo);
                    }
                }
            }