提交 16ea9949 编写于 作者: C CyrusNajmabadi 提交者: GitHub

Merge pull request #20150 from CyrusNajmabadi/integrationTestHang

Switch back to the UI thread when cleaning up the solution in integration tests.
......@@ -286,41 +286,42 @@ private string GetProjectTemplatePath(string projectTemplate, string languageNam
}
public void CleanUpOpenSolution()
{
var dte = GetDTE();
dte.Documents.CloseAll(EnvDTE.vsSaveChanges.vsSaveChangesNo);
if (dte.Solution != null)
=> InvokeOnUIThread(() =>
{
var directoriesToDelete = new List<string>();
var dte = GetDTE();
dte.Documents.CloseAll(EnvDTE.vsSaveChanges.vsSaveChangesNo);
// Save the full path to each project in the solution. This is so we can
// cleanup any folders after the solution is closed.
foreach (EnvDTE.Project project in dte.Solution.Projects)
if (dte.Solution != null)
{
if (!string.IsNullOrEmpty(project.FullName))
var directoriesToDelete = new List<string>();
// Save the full path to each project in the solution. This is so we can
// cleanup any folders after the solution is closed.
foreach (EnvDTE.Project project in dte.Solution.Projects)
{
directoriesToDelete.Add(Path.GetDirectoryName(project.FullName));
if (!string.IsNullOrEmpty(project.FullName))
{
directoriesToDelete.Add(Path.GetDirectoryName(project.FullName));
}
}
}
// Save the full path to the solution. This is so we can cleanup any folders after the solution is closed.
// The solution might be zero-impact and thus has no name, so deal with that
var solutionFullName = dte.Solution.FullName;
// Save the full path to the solution. This is so we can cleanup any folders after the solution is closed.
// The solution might be zero-impact and thus has no name, so deal with that
var solutionFullName = dte.Solution.FullName;
if (!string.IsNullOrEmpty(solutionFullName))
{
directoriesToDelete.Add(Path.GetDirectoryName(solutionFullName));
}
if (!string.IsNullOrEmpty(solutionFullName))
{
directoriesToDelete.Add(Path.GetDirectoryName(solutionFullName));
}
dte.Solution.Close(SaveFirst: false);
dte.Solution.Close(SaveFirst: false);
foreach (var directoryToDelete in directoriesToDelete)
{
IntegrationHelper.TryDeleteDirectoryRecursively(directoryToDelete);
foreach (var directoryToDelete in directoriesToDelete)
{
IntegrationHelper.TryDeleteDirectoryRecursively(directoryToDelete);
}
}
}
}
});
private EnvDTE.Project GetProject(string nameOrFileName)
=> _solution.Projects.OfType<EnvDTE.Project>().First(p
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册