From 94ea73eee74422a1f5bda1193ab71096451aa337 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Mon, 4 Mar 2019 13:55:37 -0600 Subject: [PATCH] Close the Find Source window in case it's open See #33785 --- .../InProcess/SolutionExplorer_InProc.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/SolutionExplorer_InProc.cs b/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/SolutionExplorer_InProc.cs index 96f2c45701414..e4f09ccb53a12 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/SolutionExplorer_InProc.cs +++ b/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/SolutionExplorer_InProc.cs @@ -12,6 +12,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.EditAndContinue; using Microsoft.CodeAnalysis.Shared.TestHooks; +using Microsoft.VisualStudio.IntegrationTest.Utilities.Input; using Microsoft.VisualStudio.ProjectSystem.Properties; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; @@ -25,13 +26,17 @@ namespace Microsoft.VisualStudio.IntegrationTest.Utilities.InProcess { internal class SolutionExplorer_InProc : InProcComponent { + private readonly SendKeys_InProc _sendKeys; private Solution2 _solution; private string _fileName; private static readonly IDictionary _csharpProjectTemplates = InitializeCSharpProjectTemplates(); private static readonly IDictionary _visualBasicProjectTemplates = InitializeVisualBasicProjectTemplates(); - private SolutionExplorer_InProc() { } + private SolutionExplorer_InProc() + { + _sendKeys = new SendKeys_InProc(VisualStudio_InProc.Create()); + } public static SolutionExplorer_InProc Create() => new SolutionExplorer_InProc(); @@ -379,6 +384,10 @@ public void CleanUpOpenSolution() if (dte.Debugger.CurrentMode != EnvDTE.dbgDebugMode.dbgDesignMode) { + // Close the Find Source window in case it's open. + // 🐛 This is an ugly mitigation for https://github.com/dotnet/roslyn/issues/33785 + _sendKeys.Send(VirtualKey.Escape); + dte.Debugger.TerminateAll(); WaitForDesignMode(); }