From a6e8f8cf0cd5a42a64d687b03b4ea6f945957281 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Fri, 13 Jul 2018 11:43:16 -0500 Subject: [PATCH] Remove VisualStudioInstanceFactory._hasCurrentlyActiveContext, which is always false --- .../VisualStudioInstanceFactory.cs | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs b/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs index 55fd1bf6ef7..c1ef16c9e2d 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs +++ b/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs @@ -30,8 +30,6 @@ public sealed class VisualStudioInstanceFactory : IDisposable /// private VisualStudioInstance _currentlyRunningInstance; - private bool _hasCurrentlyActiveContext; - static VisualStudioInstanceFactory() { var majorVsProductVersion = VsProductVersion.Split('.')[0]; @@ -103,8 +101,6 @@ private static Assembly AssemblyResolveHandler(object sender, ResolveEventArgs e /// public async Task GetNewOrUsedInstanceAsync(ImmutableHashSet requiredPackageIds) { - ThrowExceptionIfAlreadyHasActiveContext(); - try { bool shouldStartNewInstance = ShouldStartNewInstance(requiredPackageIds); @@ -122,10 +118,6 @@ public async Task GetNewOrUsedInstanceAsync(Immutab internal void NotifyCurrentInstanceContextDisposed(bool canReuse) { - ThrowExceptionIfAlreadyHasActiveContext(); - - _hasCurrentlyActiveContext = false; - if (!canReuse) { _currentlyRunningInstance?.Close(); @@ -145,14 +137,6 @@ private bool ShouldStartNewInstance(ImmutableHashSet requiredPackageIds) || !_currentlyRunningInstance.IsRunning; } - private void ThrowExceptionIfAlreadyHasActiveContext() - { - if (_hasCurrentlyActiveContext) - { - throw new Exception($"The previous integration test failed to call {nameof(VisualStudioInstanceContext)}.{nameof(Dispose)}. Ensure that test does that to ensure the Visual Studio instance is correctly cleaned up."); - } - } - /// /// Starts up a new , shutting down any instances that are already running. /// @@ -331,9 +315,6 @@ public void Dispose() _currentlyRunningInstance?.Close(); _currentlyRunningInstance = null; - // We want to make sure everybody cleaned up their contexts by the end of everything - ThrowExceptionIfAlreadyHasActiveContext(); - AppDomain.CurrentDomain.FirstChanceException -= FirstChanceExceptionHandler; AppDomain.CurrentDomain.AssemblyResolve -= AssemblyResolveHandler; } -- GitLab