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

Only reset the experimental instance the first time it's launched

This improves the performance of integration tests by reducing the amount of time
it takes to restart a Visual Studio instance.
上级 a6e8f8cf
......@@ -30,6 +30,11 @@ public sealed class VisualStudioInstanceFactory : IDisposable
/// </summary>
private VisualStudioInstance _currentlyRunningInstance;
/// <summary>
/// Identifies the first time a Visual Studio instance is launched during an integration test run.
/// </summary>
private static bool _firstLaunch = true;
static VisualStudioInstanceFactory()
{
var majorVsProductVersion = VsProductVersion.Split('.')[0];
......@@ -287,11 +292,16 @@ private static Process StartNewVisualStudioProcess(string installationPath)
{
var vsExeFile = Path.Combine(installationPath, @"Common7\IDE\devenv.exe");
// BUG: Currently building with /p:DeployExtension=true does not always cause the MEF cache to recompose...
// So, run clearcache and updateconfiguration to workaround https://devdiv.visualstudio.com/DevDiv/_workitems?id=385351.
Process.Start(vsExeFile, $"/clearcache {VsLaunchArgs}").WaitForExit();
Process.Start(vsExeFile, $"/updateconfiguration {VsLaunchArgs}").WaitForExit();
Process.Start(vsExeFile, $"/resetsettings General.vssettings /command \"File.Exit\" {VsLaunchArgs}").WaitForExit();
if (_firstLaunch)
{
// BUG: Currently building with /p:DeployExtension=true does not always cause the MEF cache to recompose...
// So, run clearcache and updateconfiguration to workaround https://devdiv.visualstudio.com/DevDiv/_workitems?id=385351.
Process.Start(vsExeFile, $"/clearcache {VsLaunchArgs}").WaitForExit();
Process.Start(vsExeFile, $"/updateconfiguration {VsLaunchArgs}").WaitForExit();
Process.Start(vsExeFile, $"/resetsettings General.vssettings /command \"File.Exit\" {VsLaunchArgs}").WaitForExit();
_firstLaunch = false;
}
// Make sure we kill any leftover processes spawned by the host
IntegrationHelper.KillProcess("DbgCLR");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册