diff --git a/src/VisualStudio/TestSetup/IntegrationTestServiceCommands.cs b/src/VisualStudio/TestSetup/IntegrationTestServiceCommands.cs
index 9b2e18dbee5f6c6fbf7cfbd06868eb2022a2c779..359148610048f434bf1e4b238c861d02d69bdb1d 100644
--- a/src/VisualStudio/TestSetup/IntegrationTestServiceCommands.cs
+++ b/src/VisualStudio/TestSetup/IntegrationTestServiceCommands.cs
@@ -19,8 +19,8 @@ internal sealed class IntegrationTestServiceCommands : IDisposable
public static readonly Guid GrpIdIntegrationTestServiceCommands = new Guid("82A24540-AEBC-4883-A717-5317F0C0DAE9");
- private static readonly string DefaultPortName = string.Format(IntegrationService.PortNameFormatString, Process.GetCurrentProcess().Id);
- private static readonly BinaryServerFormatterSinkProvider DefaultSinkProvider = new BinaryServerFormatterSinkProvider() {
+ private static readonly BinaryServerFormatterSinkProvider DefaultSinkProvider = new BinaryServerFormatterSinkProvider()
+ {
TypeFilterLevel = TypeFilterLevel.Full
};
@@ -78,13 +78,19 @@ public void Dispose()
StopServiceCallback(this, EventArgs.Empty);
}
- /// Starts the IPC server for the Integration Test service.
+ ///
+ /// Starts the IPC server for the Integration Test service.
+ ///
private void StartServiceCallback(object sender, EventArgs e)
{
if (_startServiceMenuCmd.Enabled)
{
_service = new IntegrationService();
- _serviceChannel = new IpcServerChannel(null, DefaultPortName, DefaultSinkProvider);
+
+ _serviceChannel = new IpcServerChannel(
+ name: null,
+ portName: _service.PortName,
+ sinkProvider: DefaultSinkProvider);
var serviceType = typeof(IntegrationService);
_marshalledService = RemotingServices.Marshal(_service, serviceType.FullName, serviceType);
diff --git a/src/VisualStudio/TestUtilities/Extensions/DteExtensions.cs b/src/VisualStudio/TestUtilities/Extensions/DteExtensions.cs
index 45264ceb05ef1b450ac4aa01f016c02eca62108b..45ed47acf3cc2b1deafe40d2a324f37b3bc2eaae 100644
--- a/src/VisualStudio/TestUtilities/Extensions/DteExtensions.cs
+++ b/src/VisualStudio/TestUtilities/Extensions/DteExtensions.cs
@@ -33,6 +33,12 @@ public static Window LocateWindow(this DTE dte, string windowTitle)
}
public static Task WaitForCommandAvailabilityAsync(this DTE dte, string command)
- => IntegrationHelper.WaitForResultAsync(() => IntegrationHelper.RetryRpcCall(() => dte.Commands.Item(command).IsAvailable), expectedResult: true);
+ {
+ return IntegrationHelper.WaitForResultAsync(() =>
+ {
+ return IntegrationHelper.RetryRpcCall(() => dte.Commands.Item(command).IsAvailable);
+ },
+ expectedResult: true);
+ }
}
}
diff --git a/src/VisualStudio/TestUtilities/Extensions/IntegrationServiceExtensions.cs b/src/VisualStudio/TestUtilities/Extensions/IntegrationServiceExtensions.cs
deleted file mode 100644
index a0a0d56e88c681121cedd5d5c1b1ec34b32c32d0..0000000000000000000000000000000000000000
--- a/src/VisualStudio/TestUtilities/Extensions/IntegrationServiceExtensions.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Reflection;
-
-namespace Roslyn.VisualStudio.Test.Utilities
-{
- internal static class IntegrationServiceExtensions
- {
- public static void Execute(this IntegrationService integrationService, Type type, string methodName, BindingFlags bindingFlags = (BindingFlags.Public | BindingFlags.Static), params object[] parameters)
- => Execute(integrationService, type.Assembly.Location, type.FullName, methodName, bindingFlags, parameters);
-
- public static T Execute(this IntegrationService integrationService, Type type, string methodName, BindingFlags bindingFlags = (BindingFlags.Public | BindingFlags.Static), params object[] parameters)
- => Execute(integrationService, type.Assembly.Location, type.FullName, methodName, bindingFlags, parameters);
-
- public static void Execute(this IntegrationService integrationService, string assemblyFilePath, string typeFullName, string methodName, BindingFlags bindingFlags = (BindingFlags.Public | BindingFlags.Static), params object[] parameters)
- {
- var result = integrationService.Execute(assemblyFilePath, typeFullName, methodName, bindingFlags, parameters);
-
- if (result != null)
- {
- throw new InvalidOperationException("The specified call was not expected to return a value.");
- }
- }
-
- public static T Execute(this IntegrationService integrationService, string assemblyFilePath, string typeFullName, string methodName, BindingFlags bindingFlags = (BindingFlags.Public | BindingFlags.Static), params object[] parameters)
- {
- var objectUri = integrationService.Execute(assemblyFilePath, typeFullName, methodName, bindingFlags, parameters);
-
- if (objectUri == null)
- {
- throw new InvalidOperationException("The specified call was expected to return a value.");
- }
-
- return (T)(Activator.GetObject(typeof(T), $"{integrationService.Uri}/{objectUri}"));
- }
- }
-}
diff --git a/src/VisualStudio/TestUtilities/IntegrationHelper.cs b/src/VisualStudio/TestUtilities/IntegrationHelper.cs
index 7e95ffefe8bc4f0459cc83f827d1a442888a7da9..1ea8d900ab6174f17fd1ba591359f5d00d720d48 100644
--- a/src/VisualStudio/TestUtilities/IntegrationHelper.cs
+++ b/src/VisualStudio/TestUtilities/IntegrationHelper.cs
@@ -21,7 +21,9 @@
namespace Roslyn.VisualStudio.Test.Utilities
{
- /// Provides some helper functions used by the other classes in the project.
+ ///
+ /// Provides some helper functions used by the other classes in the project.
+ ///
internal static class IntegrationHelper
{
public static bool AttachThreadInput(uint idAttach, uint idAttachTo)
@@ -519,7 +521,7 @@ public static DTE TryLocateDteForProcess(Process process)
}
while (dte == null);
- return (DTE)(dte);
+ return (DTE)dte;
}
public static void UnblockInput()
diff --git a/src/VisualStudio/TestUtilities/IntegrationService.cs b/src/VisualStudio/TestUtilities/IntegrationService.cs
index 9d4b222203aab3bef3408136039e72c5b84eab8a..d31c8ab7de15012d510bcfaef8589ed7440401b3 100644
--- a/src/VisualStudio/TestUtilities/IntegrationService.cs
+++ b/src/VisualStudio/TestUtilities/IntegrationService.cs
@@ -2,26 +2,55 @@
using System;
using System.Collections.Concurrent;
+using System.Diagnostics;
using System.Reflection;
using System.Runtime.Remoting;
namespace Roslyn.VisualStudio.Test.Utilities
{
- /// Provides a means of executing code in the Visual Studio host process.
- /// This object exists in the Visual Studio host and is marhsalled across the process boundary.
+ ///
+ /// Provides a means of executing code in the Visual Studio host process.
+ ///
+ ///
+ /// This object exists in the Visual Studio host and is marhsalled across the process boundary.
+ ///
internal class IntegrationService : MarshalByRefObject
{
- // Make the channel name well known by using a static base and appending the process ID of the host
- public static readonly string PortNameFormatString = $"{nameof(IntegrationService)}_{{0}}";
+ public string PortName { get; }
+
+ ///
+ /// The base Uri of the service. This resolves to a string such as ipc://IntegrationService_{HostProcessId}"
+ ///
+ public string BaseUri { get; }
private readonly ConcurrentDictionary _marshalledObjects = new ConcurrentDictionary();
- public string Execute(string assemblyFilePath, string typeFullName, string methodName, BindingFlags bindingFlags, params object[] parameters)
+ public IntegrationService()
+ {
+ // Make the channel name well-known by using a static base and appending the process ID of the host
+ this.PortName = GetPortName(Process.GetCurrentProcess().Id);
+ this.BaseUri = "ipc://" + this.PortName;
+ }
+
+ private static string GetPortName(int hostProcessId)
+ {
+ // Make the channel name well-known by using a static base and appending the process ID of the host
+ return $"{nameof(IntegrationService)}_{{{hostProcessId}}}";
+ }
+
+ public static IntegrationService GetInstanceFromHostProcess(Process hostProcess)
+ {
+ var uri = $"ipc://{GetPortName(hostProcess.Id)}/{typeof(IntegrationService).FullName}";
+
+ return (IntegrationService)Activator.GetObject(typeof(IntegrationService), uri);
+ }
+
+ public string Execute(string assemblyFilePath, string typeFullName, string methodName)
{
var assembly = Assembly.LoadFrom(assemblyFilePath);
var type = assembly.GetType(typeFullName);
- var methodInfo = type.GetMethod(methodName, bindingFlags);
- var result = methodInfo.Invoke(null, parameters);
+ var methodInfo = type.GetMethod(methodName, BindingFlags.Public | BindingFlags.Static);
+ var result = methodInfo.Invoke(null, null);
if (methodInfo.ReturnType == typeof(void))
{
@@ -30,7 +59,7 @@ public string Execute(string assemblyFilePath, string typeFullName, string metho
// Create a unique URL for each object returned, so that we can communicate with each object individually
var resultType = result.GetType();
- var marshallableResult = (MarshalByRefObject)(result);
+ var marshallableResult = (MarshalByRefObject)result;
var objectUri = $"{resultType.FullName}_{Guid.NewGuid()}";
var marshalledObject = RemotingServices.Marshal(marshallableResult, objectUri, resultType);
@@ -41,9 +70,5 @@ public string Execute(string assemblyFilePath, string typeFullName, string metho
return objectUri;
}
-
- /// The base Uri of the service.
- /// This resolves to a string such as ipc://IntegrationService_{HostProcessId}"
- public string Uri { get; set; }
}
}
diff --git a/src/VisualStudio/TestUtilities/Remoting/RemotingHelper.cs b/src/VisualStudio/TestUtilities/Remoting/RemotingHelper.cs
index 55b69809d5877ae0f6bef0c4fb3fa5549803d5dd..acfec3e79ceb00511852f4e2ba6f24e672f746d1 100644
--- a/src/VisualStudio/TestUtilities/Remoting/RemotingHelper.cs
+++ b/src/VisualStudio/TestUtilities/Remoting/RemotingHelper.cs
@@ -26,8 +26,12 @@
namespace Roslyn.VisualStudio.Test.Utilities.Remoting
{
- /// Provides a set of helper functions for accessing services in the Visual Studio host process.
- /// This methods should be executed Visual Studio host via the method.
+ ///
+ /// Provides a set of helper functions for accessing services in the Visual Studio host process.
+ ///
+ ///
+ /// These methods should be executed Visual Studio host via the method.
+ ///
internal static class RemotingHelper
{
private static readonly Guid IWpfTextViewId = new Guid("8C40265E-9FDB-4F54-A0FD-EBB72B7D0476");
diff --git a/src/VisualStudio/TestUtilities/VisualStudioInstance.cs b/src/VisualStudio/TestUtilities/VisualStudioInstance.cs
index 1631f45dbb0e97c8302538a29be5f1e8255f82d9..020f0708660271072ef056ab99aef465d20cbb37 100644
--- a/src/VisualStudio/TestUtilities/VisualStudioInstance.cs
+++ b/src/VisualStudio/TestUtilities/VisualStudioInstance.cs
@@ -5,7 +5,6 @@
using System.IO;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Ipc;
-using System.Threading;
using System.Threading.Tasks;
using System.Windows.Automation;
using EnvDTE;
@@ -17,8 +16,9 @@ namespace Roslyn.VisualStudio.Test.Utilities
{
public class VisualStudioInstance
{
+ public DTE DTE { get; }
+
private readonly Process _hostProcess;
- private readonly DTE _dte;
private readonly IntegrationService _integrationService;
private readonly IpcClientChannel _integrationServiceChannel;
@@ -28,24 +28,24 @@ public class VisualStudioInstance
private readonly Lazy _solutionExplorer;
private readonly Lazy _workspace;
- public VisualStudioInstance(Process process, DTE dte)
+ public VisualStudioInstance(Process hostProcess, DTE dte)
{
- _hostProcess = process;
- _dte = dte;
+ _hostProcess = hostProcess;
+ this.DTE = dte;
- dte.ExecuteCommandAsync(VisualStudioCommandNames.VsStartServiceCommand).GetAwaiter().GetResult();
+ this.DTE.ExecuteCommandAsync(VisualStudioCommandNames.VsStartServiceCommand).GetAwaiter().GetResult();
_integrationServiceChannel = new IpcClientChannel($"IPC channel client for {_hostProcess.Id}", sinkProvider: null);
ChannelServices.RegisterChannel(_integrationServiceChannel, ensureSecurity: true);
// Connect to a 'well defined, shouldn't conflict' IPC channel
- var serviceUri = string.Format($"ipc://{IntegrationService.PortNameFormatString}", _hostProcess.Id);
- _integrationService = (IntegrationService)(Activator.GetObject(typeof(IntegrationService), $"{serviceUri}/{typeof(IntegrationService).FullName}"));
- _integrationService.Uri = serviceUri;
+ _integrationService = IntegrationService.GetInstanceFromHostProcess(hostProcess);
// There is a lot of VS initialization code that goes on, so we want to wait for that to 'settle' before
// we start executing any actual code.
- _integrationService.Execute(typeof(RemotingHelper), nameof(RemotingHelper.WaitForSystemIdle));
+ ExecuteInHostProcess(
+ type: typeof(RemotingHelper),
+ methodName: nameof(RemotingHelper.WaitForSystemIdle));
_csharpInteractiveWindow = new Lazy(() => new CSharpInteractiveWindow(this));
_editorWindow = new Lazy(() => new EditorWindow(this));
@@ -56,7 +56,27 @@ public VisualStudioInstance(Process process, DTE dte)
Cleanup();
}
- public DTE Dte => _dte;
+ public void ExecuteInHostProcess(Type type, string methodName)
+ {
+ var result = _integrationService.Execute(type.Assembly.Location, type.FullName, methodName);
+
+ if (result != null)
+ {
+ throw new InvalidOperationException("The specified call was not expected to return a value.");
+ }
+ }
+
+ public T ExecuteInHostProcess(Type type, string methodName)
+ {
+ var objectUri = _integrationService.Execute(type.Assembly.Location, type.FullName, methodName);
+
+ if (objectUri == null)
+ {
+ throw new InvalidOperationException("The specified call was expected to return a value.");
+ }
+
+ return (T)Activator.GetObject(typeof(T), $"{_integrationService.BaseUri}/{objectUri}");
+ }
public bool IsRunning => !_hostProcess.HasExited;
@@ -68,10 +88,6 @@ public VisualStudioInstance(Process process, DTE dte)
public Workspace Workspace => _workspace.Value;
- internal IntegrationService IntegrationService => _integrationService;
-
- #region Automation Elements
-
public async Task ClickAutomationElementAsync(string elementName, bool recursive = false)
{
var element = await FindAutomationElementAsync(elementName, recursive).ConfigureAwait(false);
@@ -111,9 +127,6 @@ private async Task FindAutomationElementAsync(string elementN
return element;
}
- #endregion
-
- #region Cleanup
public void Cleanup()
{
CleanupOpenSolution();
@@ -124,15 +137,15 @@ public void Cleanup()
private void CleanupInteractiveWindow()
{
- var csharpInteractiveWindow = _dte.LocateWindow(CSharpInteractiveWindow.DteWindowTitle);
+ var csharpInteractiveWindow = this.DTE.LocateWindow(CSharpInteractiveWindow.DteWindowTitle);
IntegrationHelper.RetryRpcCall(() => csharpInteractiveWindow?.Close());
}
private void CleanupOpenSolution()
{
- IntegrationHelper.RetryRpcCall(() => _dte.Documents.CloseAll(vsSaveChanges.vsSaveChangesNo));
+ IntegrationHelper.RetryRpcCall(() => this.DTE.Documents.CloseAll(vsSaveChanges.vsSaveChangesNo));
- var dteSolution = IntegrationHelper.RetryRpcCall(() => _dte.Solution);
+ var dteSolution = IntegrationHelper.RetryRpcCall(() => this.DTE.Solution);
if (dteSolution != null)
{
@@ -173,27 +186,25 @@ private void CleanupOpenSolution()
private void CleanupWaitingService()
{
- _integrationService.Execute(
+ ExecuteInHostProcess(
type: typeof(RemotingHelper),
methodName: nameof(RemotingHelper.CleanupWaitingService));
}
private void CleanupWorkspace()
{
- _integrationService.Execute(
+ ExecuteInHostProcess(
type: typeof(RemotingHelper),
methodName: nameof(RemotingHelper.CleanupWorkspace));
}
- #endregion
-
- #region Close
public void Close()
{
if (!IsRunning)
{
return;
}
+
Cleanup();
CloseRemotingService();
@@ -202,7 +213,7 @@ public void Close()
private void CloseHostProcess()
{
- IntegrationHelper.RetryRpcCall(() => _dte.Quit());
+ IntegrationHelper.RetryRpcCall(() => this.DTE.Quit());
IntegrationHelper.KillProcess(_hostProcess);
}
@@ -211,9 +222,9 @@ private void CloseRemotingService()
{
try
{
- if ((IntegrationHelper.RetryRpcCall(() => _dte?.Commands.Item(VisualStudioCommandNames.VsStopServiceCommand).IsAvailable).GetValueOrDefault()))
+ if ((IntegrationHelper.RetryRpcCall(() => this.DTE?.Commands.Item(VisualStudioCommandNames.VsStopServiceCommand).IsAvailable).GetValueOrDefault()))
{
- _dte.ExecuteCommandAsync(VisualStudioCommandNames.VsStopServiceCommand).GetAwaiter().GetResult();
+ this.DTE.ExecuteCommandAsync(VisualStudioCommandNames.VsStopServiceCommand).GetAwaiter().GetResult();
}
}
finally
@@ -224,6 +235,5 @@ private void CloseRemotingService()
}
}
}
- #endregion
}
}
diff --git a/src/VisualStudio/TestUtilities/VisualStudioInstanceContext.cs b/src/VisualStudio/TestUtilities/VisualStudioInstanceContext.cs
index 9609a63e068599c922ca5ec201a6bcede02b3d81..332ad9d4fd20ce401eb741391836bde927dda23e 100644
--- a/src/VisualStudio/TestUtilities/VisualStudioInstanceContext.cs
+++ b/src/VisualStudio/TestUtilities/VisualStudioInstanceContext.cs
@@ -11,22 +11,20 @@ namespace Roslyn.VisualStudio.Test.Utilities
///
public sealed class VisualStudioInstanceContext : IDisposable
{
- private readonly VisualStudioInstance _instance;
+ public VisualStudioInstance Instance { get; }
private readonly VisualStudioInstanceFactory _instanceFactory;
internal VisualStudioInstanceContext(VisualStudioInstance instance, VisualStudioInstanceFactory instanceFactory)
{
- _instance = instance;
+ this.Instance = instance;
_instanceFactory = instanceFactory;
}
- public VisualStudioInstance Instance => _instance;
-
public void Dispose()
{
try
{
- _instance.Cleanup();
+ this.Instance.Cleanup();
_instanceFactory.NotifyCurrentInstanceContextDisposed(canReuse: true);
}
catch (Exception)
diff --git a/src/VisualStudio/TestUtilities/VisualStudioTestUtilities.csproj b/src/VisualStudio/TestUtilities/VisualStudioTestUtilities.csproj
index bee2e7c7c0101ca1808aada1110b175aa17aac9c..f6cbb9b03bb49506ef105a5a5900d53ccffda25c 100644
--- a/src/VisualStudio/TestUtilities/VisualStudioTestUtilities.csproj
+++ b/src/VisualStudio/TestUtilities/VisualStudioTestUtilities.csproj
@@ -19,7 +19,6 @@
-
diff --git a/src/VisualStudio/TestUtilities/Window/EditorWindow.cs b/src/VisualStudio/TestUtilities/Window/EditorWindow.cs
index 32a8db9dbfeeef839968801f1894788564abfa32..e94fd12a80adf45d4bb447d976798b2d6bfb9683 100644
--- a/src/VisualStudio/TestUtilities/Window/EditorWindow.cs
+++ b/src/VisualStudio/TestUtilities/Window/EditorWindow.cs
@@ -1,6 +1,5 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using System.Reflection;
using Roslyn.VisualStudio.Test.Utilities.Remoting;
namespace Roslyn.VisualStudio.Test.Utilities
@@ -18,10 +17,9 @@ internal EditorWindow(VisualStudioInstance visualStudioInstance)
_visualStudioInstance = visualStudioInstance;
// Create MarshalByRefObject that can be used to execute code in the VS process.
- _editorWindowWrapper = _visualStudioInstance.IntegrationService.Execute(
+ _editorWindowWrapper = _visualStudioInstance.ExecuteInHostProcess(
type: typeof(EditorWindowWrapper),
- methodName: nameof(EditorWindowWrapper.Create),
- bindingFlags: BindingFlags.Public | BindingFlags.Static);
+ methodName: nameof(EditorWindowWrapper.Create));
}
public string GetText() => _editorWindowWrapper.GetText();
@@ -37,7 +35,7 @@ public void Activate()
{
IntegrationHelper.RetryRpcCall(() =>
{
- _visualStudioInstance.Dte.ActiveDocument.Activate();
+ _visualStudioInstance.DTE.ActiveDocument.Activate();
});
}
}
diff --git a/src/VisualStudio/TestUtilities/Window/EditorWindow_SendKeys.cs b/src/VisualStudio/TestUtilities/Window/EditorWindow_SendKeys.cs
index d5dbf1c356d98010bdd1643bb7e60937b2bf7953..7126b88d413d625736e5a2fa7089ca26d9689a61 100644
--- a/src/VisualStudio/TestUtilities/Window/EditorWindow_SendKeys.cs
+++ b/src/VisualStudio/TestUtilities/Window/EditorWindow_SendKeys.cs
@@ -98,7 +98,7 @@ public void SendKey(VirtualKey virtualKey, ShiftState shiftState = 0)
inputBlocked = IntegrationHelper.BlockInput();
foregroundWindow = IntegrationHelper.GetForegroundWindow();
- _visualStudioInstance.IntegrationService.Execute(
+ _visualStudioInstance.ExecuteInHostProcess(
type: typeof(RemotingHelper),
methodName: nameof(RemotingHelper.ActivateMainWindow));
diff --git a/src/VisualStudio/TestUtilities/Window/InteractiveWindow.cs b/src/VisualStudio/TestUtilities/Window/InteractiveWindow.cs
index e3da9abbe8bd54b8b53b96bfbbec5cd0e656c412..ea96cedc65afc322d81747b1f298bf322b14d6a8 100644
--- a/src/VisualStudio/TestUtilities/Window/InteractiveWindow.cs
+++ b/src/VisualStudio/TestUtilities/Window/InteractiveWindow.cs
@@ -25,12 +25,11 @@ internal InteractiveWindow(VisualStudioInstance visualStudioInstance, string dte
// We have to show the window at least once to ensure the interactive service is loaded.
ShowAsync(waitForPrompt: false).GetAwaiter().GetResult();
- var dteWindow = IntegrationHelper.WaitForNotNullAsync(() => _visualStudioInstance.Dte.LocateWindow(dteWindowTitle)).GetAwaiter().GetResult();
+ var dteWindow = IntegrationHelper.WaitForNotNullAsync(() => _visualStudioInstance.DTE.LocateWindow(dteWindowTitle)).GetAwaiter().GetResult();
IntegrationHelper.RetryRpcCall(() => dteWindow.Close());
// Return a wrapper to the actual interactive window service that exists in the host process
- var integrationService = _visualStudioInstance.IntegrationService;
- _interactiveWindowWrapper = integrationService.Execute(typeof(InteractiveWindowWrapper), createMethodName);
+ _interactiveWindowWrapper = _visualStudioInstance.ExecuteInHostProcess(typeof(InteractiveWindowWrapper), createMethodName);
}
///
@@ -94,7 +93,7 @@ public string GetReplTextWithoutPrompt()
public async Task ResetAsync(bool waitForPrompt = true)
{
- await _visualStudioInstance.Dte.ExecuteCommandAsync(DteReplResetCommand).ConfigureAwait(continueOnCapturedContext: false);
+ await _visualStudioInstance.DTE.ExecuteCommandAsync(DteReplResetCommand).ConfigureAwait(continueOnCapturedContext: false);
if (waitForPrompt)
{
@@ -104,7 +103,7 @@ public async Task ResetAsync(bool waitForPrompt = true)
public async Task ShowAsync(bool waitForPrompt = true)
{
- await _visualStudioInstance.Dte.ExecuteCommandAsync(_dteViewCommand).ConfigureAwait(continueOnCapturedContext: false);
+ await _visualStudioInstance.DTE.ExecuteCommandAsync(_dteViewCommand).ConfigureAwait(continueOnCapturedContext: false);
if (waitForPrompt)
{
diff --git a/src/VisualStudio/TestUtilities/Window/SolutionExplorer.cs b/src/VisualStudio/TestUtilities/Window/SolutionExplorer.cs
index 1f9f177f2d04f781c2b14711200cf668666a91b4..27eda110fa4e2377f51ac6c159ea571daa2d305a 100644
--- a/src/VisualStudio/TestUtilities/Window/SolutionExplorer.cs
+++ b/src/VisualStudio/TestUtilities/Window/SolutionExplorer.cs
@@ -23,7 +23,7 @@ internal SolutionExplorer(VisualStudioInstance visualStudio)
/// Creates and loads a new solution in the host process, optionally saving the existing solution if one exists.
public Solution CreateSolution(string solutionName, bool saveExistingSolutionIfExists = false)
{
- var dteSolution = IntegrationHelper.RetryRpcCall(() => _visualStudio.Dte.Solution);
+ var dteSolution = IntegrationHelper.RetryRpcCall(() => _visualStudio.DTE.Solution);
if (IntegrationHelper.RetryRpcCall(() => dteSolution.IsOpen))
{
@@ -41,7 +41,7 @@ public Solution CreateSolution(string solutionName, bool saveExistingSolutionIfE
public Solution OpenSolution(string path, bool saveExistingSolutionIfExists = false)
{
- var dteSolution = IntegrationHelper.RetryRpcCall(() => _visualStudio.Dte.Solution);
+ var dteSolution = IntegrationHelper.RetryRpcCall(() => _visualStudio.DTE.Solution);
if (IntegrationHelper.RetryRpcCall(() => dteSolution.IsOpen))
{
@@ -54,6 +54,6 @@ public Solution OpenSolution(string path, bool saveExistingSolutionIfExists = fa
return _solution;
}
- public void CloseSolution(bool saveFirst = false) => IntegrationHelper.RetryRpcCall(() => _visualStudio.Dte.Solution.Close(saveFirst));
+ public void CloseSolution(bool saveFirst = false) => IntegrationHelper.RetryRpcCall(() => _visualStudio.DTE.Solution.Close(saveFirst));
}
}
diff --git a/src/VisualStudio/TestUtilities/Workspace/Workspace.cs b/src/VisualStudio/TestUtilities/Workspace/Workspace.cs
index 62f5760da921332aee751453de541123c4d5a986..c1099c1aa31ac1086e70a6525d0ddbbb8eaac2e5 100644
--- a/src/VisualStudio/TestUtilities/Workspace/Workspace.cs
+++ b/src/VisualStudio/TestUtilities/Workspace/Workspace.cs
@@ -13,8 +13,9 @@ internal Workspace(VisualStudioInstance visualStudioInstance)
{
_visualStudioInstance = visualStudioInstance;
- var integrationService = _visualStudioInstance.IntegrationService;
- _workspaceWrapper = integrationService.Execute(typeof(WorkspaceWrapper), nameof(WorkspaceWrapper.Create));
+ _workspaceWrapper = _visualStudioInstance.ExecuteInHostProcess(
+ type: typeof(WorkspaceWrapper),
+ methodName: nameof(WorkspaceWrapper.Create));
}
public bool UseSuggestionMode