提交 a6e8f8cf 编写于 作者: S Sam Harwell

Remove VisualStudioInstanceFactory._hasCurrentlyActiveContext, which is always false

上级 3146b8b4
......@@ -30,8 +30,6 @@ public sealed class VisualStudioInstanceFactory : IDisposable
/// </summary>
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
/// </summary>
public async Task<VisualStudioInstanceContext> GetNewOrUsedInstanceAsync(ImmutableHashSet<string> requiredPackageIds)
{
ThrowExceptionIfAlreadyHasActiveContext();
try
{
bool shouldStartNewInstance = ShouldStartNewInstance(requiredPackageIds);
......@@ -122,10 +118,6 @@ public async Task<VisualStudioInstanceContext> GetNewOrUsedInstanceAsync(Immutab
internal void NotifyCurrentInstanceContextDisposed(bool canReuse)
{
ThrowExceptionIfAlreadyHasActiveContext();
_hasCurrentlyActiveContext = false;
if (!canReuse)
{
_currentlyRunningInstance?.Close();
......@@ -145,14 +137,6 @@ private bool ShouldStartNewInstance(ImmutableHashSet<string> 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.");
}
}
/// <summary>
/// Starts up a new <see cref="VisualStudioInstance"/>, shutting down any instances that are already running.
/// </summary>
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册