Beispiel #1
0
 protected override void Dispose(bool finalize)
 {
     base.Dispose(finalize);
     CancelLoad();
     if (IdeApp.Workspace != null)
     {
         IdeApp.Workspace.ActiveConfigurationChanged -= HandleActiveConfigurationChanged;
     }
     if (currentMonoDevelopSolution != null)
     {
         foreach (var prj in currentMonoDevelopSolution.GetAllProjects())
         {
             UnloadMonoProject(prj);
         }
         currentMonoDevelopSolution = null;
     }
 }
Beispiel #2
0
        async Task <SolutionInfo> CreateSolutionInfo(MonoDevelop.Projects.Solution solution, CancellationToken token)
        {
            var projects   = new ConcurrentBag <ProjectInfo> ();
            var mdProjects = solution.GetAllProjects();

            projectionList.Clear();
            solutionData = new SolutionData();

            List <Task> allTasks = new List <Task> ();

            foreach (var proj in mdProjects)
            {
                if (token.IsCancellationRequested)
                {
                    return(null);
                }
                if (!SupportsRoslyn(proj))
                {
                    continue;
                }
                var tp = LoadProject(proj, token).ContinueWith(t => {
                    if (!t.IsCanceled)
                    {
                        projects.Add(t.Result);
                    }
                });
                allTasks.Add(tp);
            }
            await Task.WhenAll(allTasks.ToArray());

            if (token.IsCancellationRequested)
            {
                return(null);
            }
            var solutionInfo = SolutionInfo.Create(GetSolutionId(solution), VersionStamp.Create(), solution.FileName, projects);

            lock (addLock) {
                if (!added)
                {
                    added = true;
                    OnSolutionAdded(solutionInfo);
                }
            }
            return(solutionInfo);
        }