From c6a7a728ea03c41821a3006c4db1524b963e2c59 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Thu, 18 Oct 2018 16:26:12 -0700 Subject: [PATCH] Add additional waits for for the Workspace when async things happen --- .../OutOfProcess/SolutionExplorer_OutOfProc.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/SolutionExplorer_OutOfProc.cs b/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/SolutionExplorer_OutOfProc.cs index 0be408e9dfd..2af9be9abc8 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/SolutionExplorer_OutOfProc.cs +++ b/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/SolutionExplorer_OutOfProc.cs @@ -102,13 +102,21 @@ public void OpenFileWithDesigner(ProjectUtils.Project project, string fileName) => _inProc.OpenFileWithDesigner(project.Name, fileName); public void OpenFile(ProjectUtils.Project project, string fileName) - => _inProc.OpenFile(project.Name, fileName); + { + // Wireup to open files can happen asynchronously in the case we're being notified of changes on background threads. + _inProc.OpenFile(project.Name, fileName); + _instance.Workspace.WaitForAsyncOperations(FeatureAttribute.Workspace); + } public void UpdateFile(string projectName, string fileName, string contents, bool open = false) => _inProc.UpdateFile(projectName, fileName, contents, open); public void RenameFile(ProjectUtils.Project project, string oldFileName, string newFileName) - => _inProc.RenameFile(project.Name, oldFileName, newFileName); + { + // Wireup to open files can happen asynchronously in the case we're being notified of changes on background threads. + _inProc.RenameFile(project.Name, oldFileName, newFileName); + _instance.Workspace.WaitForAsyncOperations(FeatureAttribute.Workspace); + } public void CloseFile(ProjectUtils.Project project, string fileName, bool saveFile) => _inProc.CloseFile(project.Name, fileName, saveFile); -- GitLab