diff --git a/Common/Tests/MockVsTests/MockVsTests.csproj b/Common/Tests/MockVsTests/MockVsTests.csproj
index bb22c27fa9..51095bfb8a 100644
--- a/Common/Tests/MockVsTests/MockVsTests.csproj
+++ b/Common/Tests/MockVsTests/MockVsTests.csproj
@@ -10,10 +10,6 @@
Microsoft.VisualStudioTools.MockVsTestsMockVsTests512
- SAK
- SAK
- SAK
- SAKx86
diff --git a/Common/Tests/SccPackage/TestSccPackage.csproj b/Common/Tests/SccPackage/TestSccPackage.csproj
index 0c4aa00535..c5d4130d74 100644
--- a/Common/Tests/SccPackage/TestSccPackage.csproj
+++ b/Common/Tests/SccPackage/TestSccPackage.csproj
@@ -44,10 +44,6 @@
PropertiesMicrosoft.TestSccPackageTestSccPackage
- SAK
- SAK
- SAK
- SAKtruefalse
diff --git a/Common/Tests/SharedProjectTests/SharedProjectTests.csproj b/Common/Tests/SharedProjectTests/SharedProjectTests.csproj
index 67bc44956f..8297051aed 100644
--- a/Common/Tests/SharedProjectTests/SharedProjectTests.csproj
+++ b/Common/Tests/SharedProjectTests/SharedProjectTests.csproj
@@ -10,10 +10,6 @@
Microsoft.VisualStudioTools.SharedProjectTestsSharedProjectTests512
- SAK
- SAK
- SAK
- SAKAnyCPU
diff --git a/Common/Tests/Utilities.UI/TestUtilities.UI.csproj b/Common/Tests/Utilities.UI/TestUtilities.UI.csproj
index 8d74d867c3..a911b3ccca 100644
--- a/Common/Tests/Utilities.UI/TestUtilities.UI.csproj
+++ b/Common/Tests/Utilities.UI/TestUtilities.UI.csproj
@@ -12,10 +12,6 @@
TestUtilities.UITestUtilities.UI512
- SAK
- SAK
- SAK
- SAKx86
diff --git a/Common/Tests/Utilities/TestUtilities.csproj b/Common/Tests/Utilities/TestUtilities.csproj
index 6329d17bbb..fb112dde87 100644
--- a/Common/Tests/Utilities/TestUtilities.csproj
+++ b/Common/Tests/Utilities/TestUtilities.csproj
@@ -2,10 +2,6 @@
- SAK
- SAK
- SAK
- SAKDebugx868.0.30703
diff --git a/Python/Product/Analysis/Analysis.csproj b/Python/Product/Analysis/Analysis.csproj
index df1685d7d4..b5125f5d28 100644
--- a/Python/Product/Analysis/Analysis.csproj
+++ b/Python/Product/Analysis/Analysis.csproj
@@ -47,10 +47,6 @@
512true
- SAK
- SAK
- SAK
- SAKAnyCPU
diff --git a/Python/Product/AnalysisBrowser/AnalysisBrowser.csproj b/Python/Product/AnalysisBrowser/AnalysisBrowser.csproj
index d3fab7fdd8..2175051335 100644
--- a/Python/Product/AnalysisBrowser/AnalysisBrowser.csproj
+++ b/Python/Product/AnalysisBrowser/AnalysisBrowser.csproj
@@ -44,10 +44,6 @@
512{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}4
- SAK
- SAK
- SAK
- SAK
diff --git a/Python/Product/AnalysisBrowser/AnalysisBrowser.sln b/Python/Product/AnalysisBrowser/AnalysisBrowser.sln
index 7fa8c8c2af..71033d1a68 100644
--- a/Python/Product/AnalysisBrowser/AnalysisBrowser.sln
+++ b/Python/Product/AnalysisBrowser/AnalysisBrowser.sln
@@ -6,21 +6,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Analysis", "..\Analysis\Analysis.csproj", "{A85D479D-67A9-4BDB-904A-7D86DAF68A6F}"
EndProject
Global
- GlobalSection(TeamFoundationVersionControl) = preSolution
- SccNumberOfProjects = 2
- SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
- SccTeamFoundationServer = http://tcvstf:8080/tfs/tc
- SccProjectUniqueName0 = ..\\Analysis\\Analysis.csproj
- SccProjectName0 = ../Analysis
- SccAuxPath0 = http://tcvstf:8080/tfs/tc
- SccLocalPath0 = ..\\Analysis
- SccProvider0 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
- SccProjectUniqueName1 = AnalysisBrowser.csproj
- SccProjectName1 = .
- SccAuxPath1 = http://tcvstf:8080/tfs/tc
- SccLocalPath1 = .
- SccProvider1 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
- EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
diff --git a/Python/Product/AnalysisMemoryTester/AnalysisMemoryTester.csproj b/Python/Product/AnalysisMemoryTester/AnalysisMemoryTester.csproj
index 094c7270d0..54b0d7a045 100644
--- a/Python/Product/AnalysisMemoryTester/AnalysisMemoryTester.csproj
+++ b/Python/Product/AnalysisMemoryTester/AnalysisMemoryTester.csproj
@@ -42,10 +42,6 @@
Microsoft.PythonTools.Analysis.MemoryTesterAnalysisMemoryTester512
- SAK
- SAK
- SAK
- SAKAnyCPU
diff --git a/Python/Product/Analyzer/Analyzer.csproj b/Python/Product/Analyzer/Analyzer.csproj
index 4063f876b0..c4124e1f77 100644
--- a/Python/Product/Analyzer/Analyzer.csproj
+++ b/Python/Product/Analyzer/Analyzer.csproj
@@ -45,10 +45,6 @@
Microsoft.PythonTools.AnalysisMicrosoft.PythonTools.Analyzer512
- SAK
- SAK
- SAK
- SAKtrue
diff --git a/Python/Product/Attacher/Attacher.csproj b/Python/Product/Attacher/Attacher.csproj
index 7af693a912..21e9435b63 100644
--- a/Python/Product/Attacher/Attacher.csproj
+++ b/Python/Product/Attacher/Attacher.csproj
@@ -45,10 +45,6 @@
Microsoft.PythonTools.DebuggerMicrosoft.PythonTools.Attacher512
- SAK
- SAK
- SAK
- SAK
-
- <_VSTestHost Include="@(_VSVersions->'..\VSTestHost\bin\$(Configuration)_%(Identity).0\Microsoft.VisualStudioTools.VSTestHost.%(Identity).0.dll')">
- $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\VSTestHost\bin\$(Configuration)_%(Identity).0\Microsoft.VisualStudioTools.VSTestHost.%(Identity).0.pkgdef'))
- $(MSBuildThisFileDirectory)\..\VSTestHost\VSTestHost.csproj
- Platform=AnyCPU;Configuration=$(Configuration);VisualStudioVersion=%(Identity).0;DeployExtension=false
- %(Identity)
-
-
-
-
-
- <_VSTestHost Include="@(_VSVersions->'$(VSTestHostSignedBinariesPath)\Microsoft.VisualStudioTools.VSTestHost.%(Identity).0.dll')">
- $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\VSTestHost\bin\$(Configuration)_%(Identity).0\Microsoft.VisualStudioTools.VSTestHost.%(Identity).0.pkgdef'))
- %(Identity)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SupportedVSVersions=@(VSTestHost->'%(VSVersion)','%3b');
- @(VSTestHost->'VSTestHostDLLSource%(VSVersion)=%(FullPath)',';');
- @(VSTestHost->'VSTestHostPkgdefSource%(VSVersion)=%(PkgdefFullPath)',';');
- @(VSTestHost->'VSTestHostName%(VSVersion)=Microsoft.VisualStudioTools.VSTestHost.%(VSVersion).0',';');
- $(DefineConstants)
-
-
-
-
\ No newline at end of file
diff --git a/Tools/VSTestHost/Installer/Installer.wixproj.vspscc b/Tools/VSTestHost/Installer/Installer.wixproj.vspscc
deleted file mode 100644
index feffdecaa4..0000000000
--- a/Tools/VSTestHost/Installer/Installer.wixproj.vspscc
+++ /dev/null
@@ -1,10 +0,0 @@
-""
-{
-"FILE_VERSION" = "9237"
-"ENLISTMENT_CHOICE" = "NEVER"
-"PROJECT_FILE_RELATIVE_PATH" = ""
-"NUMBER_OF_EXCLUDED_FILES" = "0"
-"ORIGINAL_PROJECT_FILE_PATH" = ""
-"NUMBER_OF_NESTED_PROJECTS" = "0"
-"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
-}
diff --git a/Tools/VSTestHost/Installer/Product.wxs b/Tools/VSTestHost/Installer/Product.wxs
deleted file mode 100644
index 37d53d3866..0000000000
--- a/Tools/VSTestHost/Installer/Product.wxs
+++ /dev/null
@@ -1,205 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- NOT VS10TARGET
-
-
-
-
-
-
-
-
-
-
-
- NOT VS11TARGET
-
-
-
-
-
-
-
-
-
-
-
- NOT VS12TARGET
-
-
-
-
-
-
-
-
-
-
-
-
-
- NOT VS14TARGET
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(var.VSSKU)$(var.VSVersion)INSTALLED
-
-
- $(var.VSSKU)$(var.VSVersion)INSTALLED
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(var.Condition)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Tools/VSTestHost/VSTestHost.sln b/Tools/VSTestHost/VSTestHost.sln
deleted file mode 100644
index 72caec7a6e..0000000000
--- a/Tools/VSTestHost/VSTestHost.sln
+++ /dev/null
@@ -1,41 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.30501.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSTestHost", "VSTestHost\VSTestHost.csproj", "{5EAD9B97-793D-404E-988E-7A93E7D5F2E8}"
-EndProject
-Global
- GlobalSection(TeamFoundationVersionControl) = preSolution
- SccNumberOfProjects = 2
- SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
- SccTeamFoundationServer = http://vstfdevdiv:8080/devdiv2
- SccLocalPath0 = .
- SccProjectUniqueName1 = VSTestHost\\VSTestHost.csproj
- SccProjectName1 = VSTestHost
- SccLocalPath1 = VSTestHost
- EndGlobalSection
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|Mixed Platforms = Debug|Mixed Platforms
- Debug|x86 = Debug|x86
- Release|Any CPU = Release|Any CPU
- Release|Mixed Platforms = Release|Mixed Platforms
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {5EAD9B97-793D-404E-988E-7A93E7D5F2E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5EAD9B97-793D-404E-988E-7A93E7D5F2E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {5EAD9B97-793D-404E-988E-7A93E7D5F2E8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {5EAD9B97-793D-404E-988E-7A93E7D5F2E8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {5EAD9B97-793D-404E-988E-7A93E7D5F2E8}.Debug|x86.ActiveCfg = Debug|Any CPU
- {5EAD9B97-793D-404E-988E-7A93E7D5F2E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5EAD9B97-793D-404E-988E-7A93E7D5F2E8}.Release|Any CPU.Build.0 = Release|Any CPU
- {5EAD9B97-793D-404E-988E-7A93E7D5F2E8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {5EAD9B97-793D-404E-988E-7A93E7D5F2E8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {5EAD9B97-793D-404E-988E-7A93E7D5F2E8}.Release|x86.ActiveCfg = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/Tools/VSTestHost/VSTestHost.vssscc b/Tools/VSTestHost/VSTestHost.vssscc
deleted file mode 100644
index 794f014c92..0000000000
--- a/Tools/VSTestHost/VSTestHost.vssscc
+++ /dev/null
@@ -1,10 +0,0 @@
-""
-{
-"FILE_VERSION" = "9237"
-"ENLISTMENT_CHOICE" = "NEVER"
-"PROJECT_FILE_RELATIVE_PATH" = ""
-"NUMBER_OF_EXCLUDED_FILES" = "0"
-"ORIGINAL_PROJECT_FILE_PATH" = ""
-"NUMBER_OF_NESTED_PROJECTS" = "0"
-"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
-}
diff --git a/Tools/VSTestHost/VSTestHost/Guids.cs b/Tools/VSTestHost/VSTestHost/Guids.cs
deleted file mode 100644
index 34ab34e0b3..0000000000
--- a/Tools/VSTestHost/VSTestHost/Guids.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-/* ****************************************************************************
- *
- * Copyright (c) Microsoft Corporation.
- *
- * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
- * copy of the license can be found in the License.html file at the root of this distribution. If
- * you cannot locate the Apache License, Version 2.0, please send an email to
- * vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
- * by the terms of the Apache License, Version 2.0.
- *
- * You must not remove this notice, or any other, from this software.
- *
- * ***************************************************************************/
-
-using System;
-
-namespace Microsoft.VisualStudioTools.VSTestHost.Internal {
- static class Guids {
- public const string VSTestHostPkgString = "4a7e4285-12f6-4ceb-b878-f029a43a5315";
- public const string UnitTestTypeString = "13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b";
-
- public static readonly Guid VSTestHostPkg = new Guid(VSTestHostPkgString);
- };
-}
\ No newline at end of file
diff --git a/Tools/VSTestHost/VSTestHost/HowThisWholeCrazyThingWorks.txt b/Tools/VSTestHost/VSTestHost/HowThisWholeCrazyThingWorks.txt
deleted file mode 100644
index 96cee21d64..0000000000
--- a/Tools/VSTestHost/VSTestHost/HowThisWholeCrazyThingWorks.txt
+++ /dev/null
@@ -1,250 +0,0 @@
- **********************************************
- ** **
- ** How This Whole Crazy Thing Works **
- ** **
- ** An extended apology **
- ** by Steve Dower **
- ** **
- **********************************************
-
-Intent
-======
-
-We are building an extension for Visual Studio that integrates into many (most)
-of its features. We would like to automatically test this extension.
-
-In general, automated tests for extensions are most efficient when the platform
-is simulated ("mocked out"). Over time, we aim to mock out as much of VS as we
-can, but integration testing can only reasonably take place within a running VS
-instance.
-
-This package (VSTestHost) allows automated tests to be launched from VS or
-MSTest that run in the context of a Visual Studio instance. This enables
-developers to validate the product in its running context.
-
-Making all of this work is messy, and this document is meant to help whoever has
-to touch it next.
-
-Sorry.
-
-
-Requirements
-============
-
- * Write and run tests using the normal VS unit testing framework
- * Execute tests in a selectable VS instance (SKU, version, hive, etc.)
- * Debug tests by selecting "Debug selected tests" within VS
- * Resilient to VS crashes during test runs
-
-
-Architecture
-============
-
-There are three executable processes involved when running these tests. Within
-VSTestHost, they are referred to as the TESTER, the TESTEE, and the EXECUTION
-ENGINE. Another concept is the TEST ADAPTER, which is a .NET class.
-
-The TESTER is the instance of Visual Studio that the developer is using to
-launch tests. If the developer is debugging tests, the TESTER is the VS instance
-that will attach to the other instance.
- - When running tests from the command line, there is no TESTER.
-
-The TESTEE is the instance of Visual Studio where the test will actually run.
-The testsettings file selected by the TESTER will determine which version, SKU,
-and hive of Visual Studio will be started as the TESTEE.
- - The TESTEE is launched and terminated by the TEST ADAPTER from the EXECUTION
- ENGINE
-
-The EXECUTION ENGINE is a separate process that allows unit tests to run with
-different process-wide settings to what the TESTER was launched with. When tests
-are launched from the TESTER, it will start the EXECUTION ENGINE with a request
-to start running the selected tests.
- - The EXECUTION ENGINE is not aware of the TESTER (which may not exist)
-
-The TEST ADAPTER is a .NET class that is loaded in the EXECUTION ENGINE and
-controls the test execution sequence. The TEST ADAPTER is initialized for a run
-and is notified when the run is paused, resumed, stopped, or aborted. The TEST
-ADAPTER is passed each test in turn to be executed and the result passed back
-via a result sink.
-
-VSTestHost includes two TEST ADAPTERs to support the IPC required to run tests
-in the TESTEE. The TEST ADAPTER loaded in the EXECUTION ENGINE is responsible
-for marshalling calls (including error handling) to the TESTEE's TEST ADAPTER,
-which is responsible for executing the test.
-
- - Neither TEST ADAPTER is the *real* unit test adapter, so executing a test
- looks more like instantiating another ITestAdapter and invoking its Run().
-
-Test Settings
-=============
-
-VSTestHost depends on the use of a testsettings file to specify the version, SKU
-and hive of VS to use as the TESTEE. The available settings are as follows:
-
- VSApplication - The registry key name, like "VisualStudio" or "WDExpress"
- VSExecutable - The executable name, like "devenv" or "wdexpress"
- VSVersion - The version number, like "12.0" or "14.0"
- VSHive [opt] - The hive name, like "Exp"
- VSLaunchTimeoutInSeconds [opt] - The number of seconds to wait for launch
- VSDebugMixedMode - True to use mixed-mode debugging for tests
-
-Run Test Sequence
-=================
-
-Because a TESTEE instance has no way of knowing whether it is actually a TESTEE
-or just an instance of VS with VSTestHost installed, all instances will open an
-IPC server and wait a short period of time for incoming connections. This server
-channel is uniquely named for the process and will not collide with other VS
-instances. The TESTEE's TEST ADAPTER is made available over this IPC channel.
-
-The typical execution sequence looks like this:
-
- 1. Developer clicks "Run selected test" in the TESTER
- 2. TESTER launches EXECUTION ENGINE
- 3. EXECUTION ENGINE loads the TEST ADAPTER
- 4. EXECUTION ENGINE calls Initialize() on the TEST ADAPTER
- 5. EXECUTION ENGINE's TEST ADAPTER reads the configuration and launches the TESTEE
- 6. TESTEE opens an IPC channel that is unique to the process and publishes its own TEST ADAPTER
- 7. EXECUTION ENGINE's TEST ADAPTER connects to the TESTEE's TEST ADAPTER and returns from Initialize().
- 8. EXECUTION ENGINE calls its TEST ADAPTER's Run() method for each test.
- 9. EXECUTION ENGINE's TEST ADAPTER calls TESTEE's TEST ADAPTER's Run() method
- 10. TESTEE's TEST ADAPTER instantiates/caches the real unit test adapter
- 11. TESTEE's TEST ADAPTER invokes the unit test adapter's Run() method
- 12. Repeat 8-11 for each test.
- 13. EXECUTION ENGINE calls its TEST ADAPTER's PreTestRunFinished() and Cleanup() methods
- 14. EXECUTION ENGINE's TEST ADAPTER exits the TESTEE.
- 15. Test run is complete.
-
-Debug Test Sequence
-===================
-
-Debugging is more complicated, because the TESTER needs to perform debug/attach
-but only the EXECUTION ENGINE knows the TESTEE's process ID. However, the
-EXECUTION ENGINE does not know the TESTER's process ID, and so cannot send a
-message directly to the TESTER. Instead, we use a global IPC server that is only
-active for a period of time after the TESTER begins debugging.
-
-Reliably detecting when a debugging session is for a unit test requires extra
-dependencies for the package loaded in the TESTER, which may prevent the
-assembly from loading or being useful in as many VS configurations as we would
-like. With our current architecture, we have a single DLL that is installed into
-the GAC and is loaded in all instances of VS, whether they will be the TESTER,
-the TESTEE, or are not taking part in unit tests at all. An alternate
-implementation would require three assemblies with two VSPackages and at least
-one vsixmanifest for the TESTER's package, as well as multiple dependencies
-between these assemblies and other dependencies that lead to a complicated and
-error-prone deployment process.
-
-Rather than dealing with this, we will open the debug IPC channel each time any
-VS instance starts debugging. If the channel is already open, the new instance
-will connect to it and signal it to terminate, so that the most recent debugging
-session is the one listening. This results in a potential race if the user
-starts multiple debugging sessions where at least one is supposed to attach to
-a TESTEE, but since this race is with a human, it is considered unlikely. If the
-EXECUTION ENGINE needs to attach but is unable to find an IPC server, it will
-abort the run and no tests are executed. The workaround is to restart debugging.
-There will also be more IPC channels opened than necessary, since we will open
-one for every debugging session unless we know the instance is a TESTEE. These
-are not much more expensive than creating a named pipe, so it is considered a
-worthwhile cost.
-
-In short, debugging works fine unless you try to break it (for example, by
-starting to debug a test then quickly starting a separate debugging session in
-another VS instance).
-
-The typical debug execution sequence looks like this:
-(Steps prefixed with an asterisk are different from the Run Test sequence.)
-
-* 1. Developer clicks "Debug selected test" in the TESTER
-* 2. TESTER launches EXECUTION ENGINE under its managed debugger.
-* 3. TESTER opens the debug IPC server. If another process has opened the server already,
- then TESTER tells it to close.
- 4. EXECUTION ENGINE loads the TEST ADAPTER
- 5. EXECUTION ENGINE calls Initialize() on the TEST ADAPTER
- 6. EXECUTION ENGINE's TEST ADAPTER reads the configuration and launches the TESTEE
- 7. TESTEE opens an IPC channel that is unique to the process and publishes its own TEST ADAPTER
-* 8. EXECUTION ENGINE's TEST ADAPTER connects to the TESTEE's TEST ADAPTER
-* 9. EXECUTION ENGINE's TEST ADAPTER connects to the debug IPC server and tells it to attach to TESTEE.
-*10. EXECUTION ENGINE's TEST ADAPTER returns from Initialize().
-*11. TESTER attaches its debugger to TESTEE.
- 12. EXECUTION ENGINE calls its TEST ADAPTER's Run() method for each test.
- 13. EXECUTION ENGINE's TEST ADAPTER calls TESTEE's TEST ADAPTER's Run() method
- 14. TESTEE's TEST ADAPTER instantiates/caches the real unit test adapter
- 15. TESTEE's TEST ADAPTER invokes the unit test adapter's Run() method
- 16. Repeat 12-15 for each test.
- 17. EXECUTION ENGINE calls its TEST ADAPTER's PreTestRunFinished() and Cleanup() methods
- 18. EXECUTION ENGINE's TEST ADAPTER exits the TESTEE.
- 19. Test run is complete.
-
-VSTestHost Classes
-==================
-
-This is an overview of the classes within VSTestHost and how they are used. Some
-classes are used in multiple places with slightly different purposes, and
-because not every VS SKU or version can support being a TESTER, some parts are
-#if'd out to allow separate builds for those. Because of the reference to
-Microsoft.VisualStudio.Shell.##.0, each VS version requires its own build of
-VSTestHost.
-
-VSTestHostPackage
------------------
-
-This package is autoloaded in every instance of VS.
-
-For TESTEEs (bearing in mind that we always initially assume this), package
-initialization creates the IPC channel and publishes its test adapter. This
-channel is not closed until the package is disposed at process exit.
-
-For TESTERs (again, this is always assumed initially), the debugging state is
-hooked so the debug IPC channel can be activated/deactivated as necessary.
-Channel creation is handled by the static members of TesterDebugAttacher. When
-the timeout expires, another TESTER manually aborts the wait, or an EXECUTION
-ENGINE signals to attach, the channel is closed.
-
-TesterDebugAttacher
--------------------
-
-This class is published over the debug IPC channel to allow the EXECUTION ENGINE
-to instruct the debugger in the TESTER to attach to the TESTEE. Other TESTERs
-may also use it to abort listeners so they can take over the channel.
-
-The class has static methods for use by the TESTER to simplify listening for
-commands.
-
-TesterTestAdapter
------------------
-
-This class is loaded in the EXECUTION ENGINE to run tests that have a
-[HostType("VSTestHost")] attribute. It is largely responsible for connecting to
-an instance of TesteeTestAdapter and marshalling calls to the TESTEE.
-
-TesteeTestAdapter
------------------
-
-This class is published from the TESTEE on the unique IPC channel created by
-VSTestHostPackage. It implements the logic for running arbitrary tests within VS
-by loading the intended test adapter.
-
-VisualStudio
-------------
-
-This class encapsulates the logic for starting VS and getting its DTE object
-from the EXECUTION ENGINE. Currently, DTE is only used by the EXECUTION ENGINE
-to safely exit VS at the end of a test run, but in the future could be used for
-tests that need to drive VS from outside the TESTEE process.
-
-VSTestContext
--------------
-
-This class is used by tests running within the TESTEE to easily access the VS
-instance's DTE and global ServiceProvider objects. Unit test projects should
-include the following reference for VSTestHost:
-
-
-
-Test projects that do not refer to VSTestContext do not require this reference.
-
-This is the only public class in the Microsoft.VisualStudioTools.VSTestHost
-assembly. All other public classes are infrastructure.
diff --git a/Tools/VSTestHost/VSTestHost/Properties/AssemblyInfo.cs b/Tools/VSTestHost/VSTestHost/Properties/AssemblyInfo.cs
deleted file mode 100644
index efbeade734..0000000000
--- a/Tools/VSTestHost/VSTestHost/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-/* ****************************************************************************
- *
- * Copyright (c) Microsoft Corporation.
- *
- * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
- * copy of the license can be found in the License.html file at the root of this distribution. If
- * you cannot locate the Apache License, Version 2.0, please send an email to
- * vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
- * by the terms of the Apache License, Version 2.0.
- *
- * You must not remove this notice, or any other, from this software.
- *
- * ***************************************************************************/
-
-using System;
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("VS Test Host")]
-[assembly: AssemblyDescription("Test host adapter for Visual Studio UI tests.")]
-[assembly: AssemblyCompany("Microsoft Corporation")]
-[assembly: AssemblyProduct("VS Test Host")]
-[assembly: AssemblyCopyright("(c) Microsoft Corporation")]
-[assembly: ComVisible(false)]
-[assembly: CLSCompliant(false)]
-[assembly: NeutralResourcesLanguage("en-US")]
-
-[assembly: AssemblyVersion(AssemblyVersionInfo.VSVersion + ".0.1.0")]
-[assembly: AssemblyFileVersion(AssemblyVersionInfo.VSVersion + ".0.1.0")]
-
-class AssemblyVersionInfo {
-#if VS10
- public const string VSVersion = "10";
-#elif VS11
- public const string VSVersion = "11";
-#elif VS12
- public const string VSVersion = "12";
-#elif VS14
- public const string VSVersion = "14";
-#endif
-}
-
diff --git a/Tools/VSTestHost/VSTestHost/RegisterSupportedTestTypeAttribute.cs b/Tools/VSTestHost/VSTestHost/RegisterSupportedTestTypeAttribute.cs
deleted file mode 100644
index a9fbc4a826..0000000000
--- a/Tools/VSTestHost/VSTestHost/RegisterSupportedTestTypeAttribute.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-/* ****************************************************************************
- *
- * Copyright (c) Microsoft Corporation.
- *
- * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
- * copy of the license can be found in the License.html file at the root of this distribution. If
- * you cannot locate the Apache License, Version 2.0, please send an email to
- * vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
- * by the terms of the Apache License, Version 2.0.
- *
- * You must not remove this notice, or any other, from this software.
- *
- * ***************************************************************************/
-
-using System;
-using Microsoft.VisualStudio.Shell;
-
-namespace Microsoft.VisualStudioTools.VSTestHost.Internal {
- sealed class RegisterSupportedTestTypeAttribute : RegistrationAttribute {
- private readonly string _hostAdapterName;
- private readonly string _hostAdapterDisplayName;
- private readonly string _testTypeGuid;
- private readonly string _testTypeName;
-
- const string SupportedTestTypesKey = @"EnterpriseTools\QualityTools\HostAdapters\{0}\SupportedTestTypes";
- const string SupportedHostAdaptersKey = @"EnterpriseTools\QualityTools\TestTypes\{0}\SupportedHostAdapters";
-
- public RegisterSupportedTestTypeAttribute(
- string hostAdapterName,
- string hostAdapterDisplayName,
- string testTypeGuid,
- string testTypeName
- ) {
- _hostAdapterName = hostAdapterName;
- _hostAdapterDisplayName = hostAdapterDisplayName;
- _testTypeGuid = new Guid(testTypeGuid).ToString("B");
- _testTypeName = testTypeName;
- }
-
- public override void Register(RegistrationAttribute.RegistrationContext context) {
- using (var key = context.CreateKey(string.Format(SupportedTestTypesKey, _hostAdapterName))) {
- key.SetValue(_testTypeGuid, _testTypeName);
- }
-
- using (var key = context.CreateKey(string.Format(SupportedHostAdaptersKey, _testTypeGuid))) {
- key.SetValue(_hostAdapterName, _hostAdapterDisplayName);
- }
- }
-
- public override void Unregister(RegistrationAttribute.RegistrationContext context) {
- context.RemoveValue(string.Format(SupportedTestTypesKey, _hostAdapterName), _testTypeGuid);
- context.RemoveKeyIfEmpty(string.Format(SupportedTestTypesKey, _hostAdapterName));
-
- context.RemoveValue(string.Format(SupportedHostAdaptersKey, _testTypeGuid), _hostAdapterName);
- context.RemoveKeyIfEmpty(string.Format(SupportedHostAdaptersKey, _testTypeGuid));
- }
- }
-}
diff --git a/Tools/VSTestHost/VSTestHost/Resources.Designer.cs b/Tools/VSTestHost/VSTestHost/Resources.Designer.cs
deleted file mode 100644
index 250f1a398e..0000000000
--- a/Tools/VSTestHost/VSTestHost/Resources.Designer.cs
+++ /dev/null
@@ -1,176 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.34014
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Microsoft.VisualStudioTools.VSTestHost.Internal {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.VisualStudioTools.VSTestHost.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- ///
- /// Looks up a localized string similar to Unable to restart Visual Studio because there is no active test run..
- ///
- internal static string CannotReconnectNoRunContext {
- get {
- return ResourceManager.GetString("CannotReconnectNoRunContext", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Unable to attach debugger to Visual Studio process..
- ///
- internal static string FailedToAttach {
- get {
- return ResourceManager.GetString("FailedToAttach", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Unable to resume test run..
- ///
- internal static string FailedToResume {
- get {
- return ResourceManager.GetString("FailedToResume", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Some required configuration values were missing.
- /// VSApplication: '{0}'
- /// VSExecutable: '{1}'
- /// VSVersion: '{2}'
- /// VSHive: '{3}'.
- ///
- internal static string MissingConfigurationValues {
- get {
- return ResourceManager.GetString("MissingConfigurationValues", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Visual Studio is no longer running..
- ///
- internal static string NoClient {
- get {
- return ResourceManager.GetString("NoClient", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to There is no active test run..
- ///
- internal static string NoRunContext {
- get {
- return ResourceManager.GetString("NoRunContext", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to No service provider is available in the current context..
- ///
- internal static string NoServiceProvider {
- get {
- return ResourceManager.GetString("NoServiceProvider", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Failed to communicate with Visual Studio process during {0}: {1}.
- ///
- internal static string RemotingError {
- get {
- return ResourceManager.GetString("RemotingError", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Failed to communicate with Visual Studio process during {0}: {1}
- ///{2}.
- ///
- internal static string RemotingErrorDebug {
- get {
- return ResourceManager.GetString("RemotingErrorDebug", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Retrying call into Visual Studio process from {0}..
- ///
- internal static string RetryRemoteCall {
- get {
- return ResourceManager.GetString("RetryRemoteCall", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Attempted to set service provider multiple time..
- ///
- internal static string ServiceProviderAlreadySet {
- get {
- return ResourceManager.GetString("ServiceProviderAlreadySet", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Visual Studio failed to start within {0} seconds..
- ///
- internal static string VSLaunchTimeout {
- get {
- return ResourceManager.GetString("VSLaunchTimeout", resourceCulture);
- }
- }
- }
-}
diff --git a/Tools/VSTestHost/VSTestHost/Resources.resx b/Tools/VSTestHost/VSTestHost/Resources.resx
deleted file mode 100644
index d115208302..0000000000
--- a/Tools/VSTestHost/VSTestHost/Resources.resx
+++ /dev/null
@@ -1,161 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- Unable to restart Visual Studio because there is no active test run.
-
-
- Unable to attach debugger to Visual Studio process.
-
-
- Unable to resume test run.
-
-
- Some required configuration values were missing.
- VSApplication: '{0}'
- VSExecutable: '{1}'
- VSVersion: '{2}'
- VSHive: '{3}'
-
-
- Visual Studio is no longer running.
-
-
- There is no active test run.
-
-
- No service provider is available in the current context.
-
-
- Failed to communicate with Visual Studio process during {0}: {1}
-
-
- Failed to communicate with Visual Studio process during {0}: {1}
-{2}
-
-
- Retrying call into Visual Studio process from {0}.
-
-
- Attempted to set service provider multiple time.
-
-
- Visual Studio failed to start within {0} seconds.
-
-
\ No newline at end of file
diff --git a/Tools/VSTestHost/VSTestHost/Resources/Package.ico b/Tools/VSTestHost/VSTestHost/Resources/Package.ico
deleted file mode 100644
index 449296f495..0000000000
Binary files a/Tools/VSTestHost/VSTestHost/Resources/Package.ico and /dev/null differ
diff --git a/Tools/VSTestHost/VSTestHost/TesteeTestAdapter.cs b/Tools/VSTestHost/VSTestHost/TesteeTestAdapter.cs
deleted file mode 100644
index 136d9de6bf..0000000000
--- a/Tools/VSTestHost/VSTestHost/TesteeTestAdapter.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-/* ****************************************************************************
- *
- * Copyright (c) Microsoft Corporation.
- *
- * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
- * copy of the license can be found in the License.html file at the root of this distribution. If
- * you cannot locate the Apache License, Version 2.0, please send an email to
- * vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
- * by the terms of the Apache License, Version 2.0.
- *
- * You must not remove this notice, or any other, from this software.
- *
- * ***************************************************************************/
-
-#if SUPPORT_TESTEE
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Runtime.Remoting;
-using Microsoft.VisualStudio.TestTools.Common;
-using Microsoft.VisualStudio.TestTools.Execution;
-using Microsoft.VisualStudio.TestTools.TestAdapter;
-
-namespace Microsoft.VisualStudioTools.VSTestHost.Internal {
- ///
- /// Acts as a communication proxy between VS instances.
- ///
- /// This class is instantiated in the client VS.
- ///
- class TesteeTestAdapter : MarshalByRefObject, ITestAdapter, IDisposable {
- private IRunContext _runContext;
- private readonly Dictionary _adapters = new Dictionary();
-
- public const string Url = "vstest";
-
- public TesteeTestAdapter() { }
-
- public void Dispose() {
- Dispose(true);
- }
-
- protected void Dispose(bool disposing) {
- if (disposing) {
- RemotingServices.Disconnect(this);
- }
- }
-
- public bool IsInitialized {
- get {
- return _runContext != null;
- }
- }
-
- private IEnumerable GetAdapters() {
- lock (_adapters) {
- return _adapters.Values.ToList();
- }
- }
-
- private ITestAdapter GetAdapter(string adapterName) {
- ITestAdapter adapter;
- lock (_adapters) {
- if (_adapters.TryGetValue(adapterName, out adapter)) {
- return adapter;
- }
- }
-
- adapter = (ITestAdapter)Activator.CreateInstance(Type.GetType(adapterName));
- if (_runContext != null) {
- adapter.Initialize(_runContext);
- }
-
- lock (_adapters) {
- try {
- _adapters.Add(adapterName, adapter);
- } catch (ArgumentException) {
- adapter.Cleanup();
- adapter = _adapters[adapterName];
- }
- }
- return adapter;
- }
-
-
- public void Initialize(IRunContext runContext) {
- _runContext = runContext;
- foreach (var adapter in GetAdapters()) {
- adapter.Initialize(runContext);
- }
- }
-
- public void PreTestRunFinished(IRunContext runContext) {
- foreach (var adapter in GetAdapters()) {
- adapter.PreTestRunFinished(runContext);
- }
- }
-
- public void ReceiveMessage(object message) {
- foreach (var adapter in GetAdapters()) {
- adapter.ReceiveMessage(message);
- }
- }
-
- public void AbortTestRun() {
- foreach (var adapter in GetAdapters()) {
- adapter.AbortTestRun();
- }
- }
-
- public void Cleanup() {
- _runContext = null;
- foreach (var adapter in GetAdapters()) {
- adapter.Cleanup();
- }
- _adapters.Clear();
- }
-
- public void PauseTestRun() {
- foreach (var adapter in GetAdapters()) {
- adapter.PauseTestRun();
- }
- }
-
- public void ResumeTestRun() {
- foreach (var adapter in GetAdapters()) {
- adapter.ResumeTestRun();
- }
- }
-
- public void Run(ITestElement testElement, ITestContext testContext) {
- var testAdapter = GetAdapter(testElement.Adapter);
-
- try {
- testAdapter.Run(testElement, testContext);
- } catch (Exception ex) {
- var message = new TextTestResultMessage(
- _runContext.RunConfig.TestRun.Id,
- testElement,
- ex.ToString()
- );
- testContext.ResultSink.AddResult(message);
- }
- }
-
- public void StopTestRun() {
- foreach (var adapter in GetAdapters()) {
- adapter.StopTestRun();
- }
- }
- }
-}
-
-#endif
diff --git a/Tools/VSTestHost/VSTestHost/TesterDebugAttacher.cs b/Tools/VSTestHost/VSTestHost/TesterDebugAttacher.cs
deleted file mode 100644
index bf36cdcd40..0000000000
--- a/Tools/VSTestHost/VSTestHost/TesterDebugAttacher.cs
+++ /dev/null
@@ -1,239 +0,0 @@
-/* ****************************************************************************
- *
- * Copyright (c) Microsoft Corporation.
- *
- * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
- * copy of the license can be found in the License.html file at the root of this distribution. If
- * you cannot locate the Apache License, Version 2.0, please send an email to
- * vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
- * by the terms of the Apache License, Version 2.0.
- *
- * You must not remove this notice, or any other, from this software.
- *
- * ***************************************************************************/
-
-#if SUPPORT_TESTER
-
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Runtime.Remoting;
-using System.Runtime.Remoting.Channels;
-using System.Security.AccessControl;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.VisualStudio;
-using Microsoft.VisualStudio.Shell;
-using Microsoft.VisualStudio.Shell.Interop;
-using Task = System.Threading.Tasks.Task;
-
-namespace Microsoft.VisualStudioTools.VSTestHost.Internal {
- sealed class TesterDebugAttacher : MarshalByRefObject {
- ///
- /// Called by the EXECUTION ENGINE to attach this TESTER to the newly
- /// started TESTEE.
- ///
- /// True if the attach occurred; otherwise, false.
- public bool AttachToProcess(int processId, bool mixedMode) {
- using (var evt = TesterDebugAttacherShared.GetNotifyEvent()) {
- if (evt == null) {
- return false;
- }
-
- var debug = ServiceProvider.GlobalProvider.GetService(typeof(SVsShellDebugger)) as IVsDebugger3;
-
- var targets = new VsDebugTargetInfo3[1];
- var results = new VsDebugTargetProcessInfo[1];
-
- targets[0].bstrExe = string.Format("\0{0:X}", processId);
- targets[0].dlo = (uint)DEBUG_LAUNCH_OPERATION.DLO_AlreadyRunning;
- targets[0].guidLaunchDebugEngine = Guid.Empty;
- targets[0].dwDebugEngineCount = 1;
-
- var engine = mixedMode ?
- VSConstants.DebugEnginesGuids.ManagedAndNative_guid :
- VSConstants.DebugEnginesGuids.ManagedOnly_guid;
-
- var pGuids = Marshal.AllocCoTaskMem(Marshal.SizeOf(engine));
- try {
- Marshal.StructureToPtr(engine, pGuids, false);
- targets[0].pDebugEngines = pGuids;
-
- ErrorHandler.ThrowOnFailure(debug.LaunchDebugTargets3((uint)targets.Length, targets, results));
- } finally {
- Marshal.FreeCoTaskMem(pGuids);
- }
- evt.Set();
- }
- return true;
- }
-
- ///
- /// Called by another TESTER to close the IPC channel so it can use it.
- ///
- public void Abort() {
- using (var evt = TesterDebugAttacherShared.GetNotifyEvent()) {
- if (evt != null) {
- evt.Set();
- }
- }
- }
- }
-
- static class TesterDebugAttacherShared {
- // This name should not change with VS version.
- private const string DebugConnectionChannelName = "VSTestHost_Debug_06420E12_C5A1_4EEF_B604_406E6A139737";
- private const string NotifyEventName = "VSTestHost_Debug_Notify_06420E12_C5A1_4EEF_B604_406E6A139737";
-
-
- // The following static functions are designed to be used by the server
- // to simplify handling the IPC channel.
-
-
- internal static EventWaitHandle GetNotifyEvent() {
- EventWaitHandle result;
- if (EventWaitHandle.TryOpenExisting(NotifyEventName, EventWaitHandleRights.Modify, out result)) {
- return result;
- }
- return null;
- }
-
- private static EventWaitHandle CreateNotifyEvent() {
- EventWaitHandle evt = null;
- bool created = false;
- while (evt == null || !created) {
- if (evt != null) {
- // Set the existing event and allow a short period to close
- evt.Set();
- evt.Dispose();
- Thread.Sleep(10);
- }
-
- try {
- evt = new EventWaitHandle(false, EventResetMode.AutoReset, NotifyEventName, out created);
- } catch (WaitHandleCannotBeOpenedException) {
- created = false;
- }
- }
- return evt;
- }
-
- ///
- /// Opens the server channel, including aborting any existing channels
- /// and retrying.
- ///
- internal static bool OpenChannel(int retries, out IChannel channel, out EventWaitHandle notifyEvent) {
- // If anyone else is listening, abort them so they close the channel
- using (var evt = GetNotifyEvent()) {
- if (evt != null) {
- evt.Set();
- }
- }
-
- channel = null;
- notifyEvent = null;
-
- while (retries-- > 0) {
- try {
- // We have to open an IPC channel with a single global name,
- // since our test adapter has no way to know which VS
- // instance started it. We will only keep the channel open
- // for a short period, and close it immediately when we stop
- // debugging. As long as you don't attempt to debug two unit
- // tests in two different VS instances at the same time,
- // nobody should get confused.
- notifyEvent = CreateNotifyEvent();
- channel = Internal.VSTestHostPackage.RegisterChannel(DebugConnectionChannelName);
- return true;
- } catch (RemotingException) {
- // Someone else is already listening, so we need to abort
- // them and try again.
- using (var evt = GetNotifyEvent()) {
- if (evt != null) {
- evt.Set();
- }
- }
- }
- }
-
- if (channel != null) {
- ChannelServices.UnregisterChannel(channel);
- channel = null;
- }
- if (notifyEvent != null) {
- notifyEvent.Dispose();
- notifyEvent = null;
- }
- return false;
- }
-
- ///
- /// Closes a channel opened by .
- ///
- internal static void CloseChannel(IChannel channel) {
- if (channel != null) {
- ChannelServices.UnregisterChannel(channel);
- }
- }
-
- ///
- /// Attaches the host VS debugger to the target process. The host VS is
- /// found by connecting to a shared IPC channel that will have been
- /// opened by the host VS when debugging started.
- ///
- ///
- /// ID of the process to attach to.
- ///
- ///
- /// True to use mixed native/CLR debugging.
- ///
- ///
- /// Failed to attach to the remote instance.
- ///
- internal static void AttachDebugger(int targetProcessId, bool useMixedMode) {
- try {
- for (int retries = 5; retries > 0; --retries) {
- if (RemoteInstance.AttachToProcess(targetProcessId, useMixedMode)) {
- return;
- }
- Thread.Sleep(100);
- }
- } catch (Exception ex) {
- throw new InvalidOperationException(Resources.FailedToAttach, ex);
- }
- throw new InvalidOperationException(Resources.FailedToAttach);
- }
-
- ///
- /// Cancels the pending wait, if any. Does not throw if we are not
- /// currently waiting for an attach.
- ///
- public static void CancelWait() {
- using (var evt = GetNotifyEvent()) {
- if (evt != null) {
- evt.Set();
- }
- }
- }
-
- ///
- /// Gets the attacher object from the remote process that is currently
- /// listening.
- ///
- ///
- /// Unable to get the remote object.
- ///
- private static TesterDebugAttacher RemoteInstance {
- get {
- return (TesterDebugAttacher)RemotingServices.Connect(
- typeof(TesterDebugAttacher),
- string.Format("ipc://{0}/debug", DebugConnectionChannelName)
- );
- }
- }
-
- }
-}
-
-#endif
diff --git a/Tools/VSTestHost/VSTestHost/TesterTestAdapter.cs b/Tools/VSTestHost/VSTestHost/TesterTestAdapter.cs
deleted file mode 100644
index 6da3812a9b..0000000000
--- a/Tools/VSTestHost/VSTestHost/TesterTestAdapter.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-/* ****************************************************************************
- *
- * Copyright (c) Microsoft Corporation.
- *
- * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
- * copy of the license can be found in the License.html file at the root of this distribution. If
- * you cannot locate the Apache License, Version 2.0, please send an email to
- * vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
- * by the terms of the Apache License, Version 2.0.
- *
- * You must not remove this notice, or any other, from this software.
- *
- * ***************************************************************************/
-
-#if SUPPORT_TESTER
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Runtime.Remoting;
-using System.Runtime.Remoting.Channels;
-using System.Runtime.Remoting.Channels.Ipc;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-using Microsoft.VisualStudio.TestTools.Common;
-using Microsoft.VisualStudio.TestTools.Execution;
-using Microsoft.VisualStudio.TestTools.TestAdapter;
-using Microsoft.VisualStudioTools.VSTestHost.Internal;
-
-namespace Microsoft.VisualStudioTools.VSTestHost {
- ///
- /// Executes tests attributed with HostType("VSTestHost").
- ///
- /// This class is instantiated by the EXECUTION ENGINE and communicates with
- /// the TESTEE via over IPC.
- ///
- class TesterTestAdapter : ITestAdapter {
- private Internal.VisualStudio _ide;
- private Guid _runId;
- private IRunContext _runContext;
- private TesteeTestAdapter _remote;
- private bool _mockVs;
-
- public TesterTestAdapter() { }
-
- private async Task Connect(
- string application,
- string executable,
- Version version,
- string hive,
- CancellationToken cancel
- ) {
- Close();
-
- Internal.VisualStudio ide = null;
- try {
- ide = await Internal.VisualStudio.LaunchAsync(application, executable, version, hive, cancel);
-
- var p = Process.GetProcessById(ide.ProcessId);
- string url = string.Format(
- "ipc://{0}/{1}",
- Internal.VSTestHostPackage.GetChannelName(Process.GetProcessById(ide.ProcessId)),
- TesteeTestAdapter.Url
- );
-
- _remote = (TesteeTestAdapter)RemotingServices.Connect(typeof(TesteeTestAdapter), url);
-
- _ide = ide;
- ide = null;
- } finally {
- if (ide != null) {
- ide.Dispose();
- }
- }
- }
-
- ///
- /// Closes VS and clears our state. Close may be called multiple times
- /// safely, and may be safely followed by another call to Connect with
- /// the same or different parameters.
- ///
- private void Close() {
- var ide = Interlocked.Exchange(ref _ide, null);
- var remote = Interlocked.Exchange(ref _remote, null);
-
- var disposableRemote = remote as IDisposable;
- if (disposableRemote != null) {
- try {
- disposableRemote.Dispose();
- } catch (RemotingException) {
- }
- }
- if (ide != null) {
- try {
- // Try to close VS gracefully, otherwise Dispose() will just
- // go in and kill it
- ide.DTE.Quit();
- } catch (Exception ex) {
- Trace.TraceError(ex.ToString());
- }
- ide.Dispose();
- }
- }
-
- private bool IsClientAlive() {
- var ide = _ide;
- var remote = _remote;
-
- if (ide == null || remote == null) {
- return false;
- }
-
- try {
- if (remote.IsInitialized) {
- return true;
- }
- } catch (RemotingException) {
- }
-
- return false;
- }
-
- ///
- /// Implements initialization. This is called by ITestAdapter.Initialize
- /// (a synchronous function) which will block until this function is
- /// completed.
- ///
- ///
- /// The context for the current test run.
- ///
- private async Task InitializeWorker(IRunContext runContext) {
- string application, executable, versionString, hive;
- Version version;
- string launchTimeoutInSecondsString;
- int launchTimeoutInSeconds;
-
- var vars = runContext.RunConfig.TestRun.RunConfiguration.TestSettingsProperties;
-
- // VSApplication is the registry key name like 'VisualStudio'
- vars.TryGetValue("VSApplication", out application);
- // VSExecutableName is the executable name like 'devenv'
- if (vars.TryGetValue("VSExecutable", out executable) &&
- !string.IsNullOrEmpty(executable) &&
- string.IsNullOrEmpty(Path.GetExtension(executable))) {
- executable = Path.ChangeExtension(executable, ".exe");
- }
- // VSVersion is the version like '12.0'
- if (!vars.TryGetValue("VSVersion", out versionString) ||
- !Version.TryParse(versionString, out version)) {
- version = null;
- }
- // VSHive is the optional hive like 'Exp'
- vars.TryGetValue("VSHive", out hive);
-
- if (!vars.TryGetValue("VSLaunchTimeoutInSeconds", out launchTimeoutInSecondsString) ||
- !int.TryParse(launchTimeoutInSecondsString, out launchTimeoutInSeconds)) {
- launchTimeoutInSeconds = 30;
- }
-
- if (string.IsNullOrEmpty(application) || string.IsNullOrEmpty(executable) || version == null) {
- throw new ArgumentException(string.Format(
- Resources.MissingConfigurationValues,
- application ?? "(null)",
- executable ?? "(null)",
- version != null ? version.ToString() : "(null)",
- hive ?? "(null)"
- ));
- }
-
- if (application == "Mock") {
- _runContext = runContext;
- _remote = new TesteeTestAdapter();
- _remote.Initialize(_runContext);
- // In the mock case tester and testee are the same process, therefore
- // VSTestContext is in our process too. So we can just set this value
- // directly here.
- VSTestContext.IsMock = true;
- _mockVs = true;
- return;
- }
-
- // TODO: Detect and perform first run of VS if necessary.
- // The first time a VS hive is run, the user sees a dialog allowing
- // them to select settings such as the theme. We can avoid this by
- // running devenv.exe /resetSettings
- // first, though it is not trivial to detect when this is necessary.
- // Without having done this, all tests will time out. For now, the
- // user is responsible for running VS at least once before
- // attempting to execute tests.
-
- var cts = new CancellationTokenSource(TimeSpan.FromSeconds(launchTimeoutInSeconds));
- try {
- await Connect(application, executable, version, hive, cts.Token);
- } catch (OperationCanceledException ex) {
- throw new TimeoutException(string.Format(Resources.VSLaunchTimeout, launchTimeoutInSeconds), ex);
- }
-
- _runContext = runContext;
- _remote.Initialize(_runContext);
-
- if (_runContext.RunConfig.TestRun.RunConfiguration.IsExecutedUnderDebugger) {
- // If we're debugging, tell our host VS to attach to the new VS
- // instance we just started.
- bool mixedMode = false;
- string debugMixedMode;
- if (!vars.TryGetValue("VSDebugMixedMode", out debugMixedMode) ||
- !bool.TryParse(debugMixedMode, out mixedMode)) {
- mixedMode = false;
- }
- TesterDebugAttacherShared.AttachDebugger(_ide.ProcessId, mixedMode);
- }
- }
-
- #region ITestAdapter members
-
- public void Initialize(IRunContext runContext) {
- if (_ide == null) {
- var runId = _runId = runContext.RunConfig.TestRun.Id;
- TestRunTextResultMessage failure = null;
-
- try {
- InitializeWorker(runContext).GetAwaiter().GetResult();
- } catch (ArgumentException ex) {
- failure = new TestRunTextResultMessage(runId, ex.Message);
- } catch (TimeoutException ex) {
- failure = new TestRunTextResultMessage(runId, ex.Message);
- } catch (Exception ex) {
- failure = new TestRunTextResultMessage(
- runId,
- string.Format("{0}: {1}{2}{3}", ex.GetType().Name, ex.Message, Environment.NewLine, ex)
- );
- failure.SystemException = ex;
- }
-
- if (failure != null) {
- runContext.ResultSink.AddResult(failure);
- runContext.StopTestRun();
- }
- }
- }
-
- private void SendMessage(IRunContext runContext, string message, ITestElement currentTest = null) {
- if (runContext == null) {
- return;
- }
-
- var runId = runContext.RunConfig.TestRun.Id;
-
- TestMessage msg;
- if (currentTest == null) {
- msg = new TestRunTextResultMessage(runId, message);
- } else {
- msg = new TextTestResultMessage(runId, currentTest, message);
- }
-
- runContext.ResultSink.AddResult(msg);
- }
-
- private bool RemoteCall(
- Action action,
- int retries = 2,
- bool restartVS = true,
- ITestElement currentTest = null,
- [CallerMemberName] string caller = null
- ) {
- var runContext = _runContext;
- if (runContext == null) {
- throw new InvalidOperationException(Resources.NoRunContext);
- }
-
- var runId = runContext.RunConfig.TestRun.Id;
-
- bool firstAttempt = true;
-
- while (retries-- > 0) {
- if (!_mockVs) {
- if (!firstAttempt) {
- // Send a message announcing that we are retrying the call
- SendMessage(
- runContext,
- string.Format(
- Resources.RetryRemoteCall,
- currentTest == null ? currentTest.HumanReadableId : caller
- ),
- currentTest
- );
- }
- firstAttempt = false;
-
- if (!IsClientAlive()) {
- Close();
-
- if (restartVS) {
- SendMessage(runContext, "Restarting VS", currentTest);
- Initialize(runContext);
- } else {
- SendMessage(runContext, Resources.NoClient, currentTest);
- return false;
- }
- }
- }
-
- var remote = _remote;
- if (remote == null) {
- return false;
- }
-
- try {
- action(remote);
- return true;
- } catch (RemotingException ex) {
-#if DEBUG
- var msg = string.Format(Resources.RemotingErrorDebug, caller, ex.Message, ex.ToString());
-#else
- var msg = string.Format(Resources.RemotingError, caller, ex.Message);
-#endif
- SendMessage(runContext, msg, currentTest);
-
- // Close _remote and let EnsureClient bring it back if
- // requested by the caller
- var disposableRemote = Interlocked.Exchange(ref _remote, null) as IDisposable;
- if (disposableRemote != null) {
- try {
- disposableRemote.Dispose();
- } catch (RemotingException) {
- }
- }
- }
- }
-
- throw new InvalidOperationException(Resources.NoClient);
- }
-
- public void Cleanup() {
- RemoteCall(r => r.Cleanup());
- Close();
- }
-
-
- public void PreTestRunFinished(IRunContext runContext) {
- RemoteCall(r => r.PreTestRunFinished(runContext));
- }
-
- public void ReceiveMessage(object message) {
- RemoteCall(r => r.ReceiveMessage(message));
- }
-
-
- public void AbortTestRun() {
- RemoteCall(r => r.AbortTestRun(), restartVS: false);
- }
-
- public void PauseTestRun() {
- RemoteCall(r => r.PauseTestRun(), restartVS: false);
- }
-
- public void ResumeTestRun() {
- if (!RemoteCall(r => r.ResumeTestRun())) {
- throw new InvalidOperationException(string.Format(Resources.FailedToResume));
- }
- }
-
- public void Run(ITestElement testElement, ITestContext testContext) {
- if (!RemoteCall(r => r.Run(testElement, testContext), currentTest: testElement)) {
- testContext.ResultSink.AddResult(new TestResult(".", _runId, testElement) {
- Outcome = TestOutcome.NotRunnable
- });
- }
- }
-
- public void StopTestRun() {
- RemoteCall(r => r.StopTestRun(), restartVS: false);
- }
-
- #endregion
- }
-}
-
-#endif
diff --git a/Tools/VSTestHost/VSTestHost/TesterTestControl.Designer.cs b/Tools/VSTestHost/VSTestHost/TesterTestControl.Designer.cs
deleted file mode 100644
index 4e633ea818..0000000000
--- a/Tools/VSTestHost/VSTestHost/TesterTestControl.Designer.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-namespace Microsoft.VisualStudioTools.VSTestHost {
- partial class TesterTestControl {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing) {
- if (disposing && (components != null)) {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent() {
- components = new System.ComponentModel.Container();
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- }
-
- #endregion
- }
-}
diff --git a/Tools/VSTestHost/VSTestHost/TesterTestControl.cs b/Tools/VSTestHost/VSTestHost/TesterTestControl.cs
deleted file mode 100644
index a373ba96ce..0000000000
--- a/Tools/VSTestHost/VSTestHost/TesterTestControl.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-/* ****************************************************************************
- *
- * Copyright (c) Microsoft Corporation.
- *
- * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
- * copy of the license can be found in the License.html file at the root of this distribution. If
- * you cannot locate the Apache License, Version 2.0, please send an email to
- * vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
- * by the terms of the Apache License, Version 2.0.
- *
- * You must not remove this notice, or any other, from this software.
- *
- * ***************************************************************************/
-
-using System.Windows.Forms;
-
-// This class is required for host adapter registration. However, we don't have
-// any UI to display, so it's blank.
-
-namespace Microsoft.VisualStudioTools.VSTestHost {
- partial class TesterTestControl : UserControl {
- public TesterTestControl() {
- InitializeComponent();
- }
- }
-}
diff --git a/Tools/VSTestHost/VSTestHost/VSPackage.resx b/Tools/VSTestHost/VSTestHost/VSPackage.resx
deleted file mode 100644
index 55733f4813..0000000000
--- a/Tools/VSTestHost/VSTestHost/VSPackage.resx
+++ /dev/null
@@ -1,140 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
-
- VSTestHost
-
-
- Allows UI testing of the Visual Studio IDE.
-
-
- Resources\Package.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
\ No newline at end of file
diff --git a/Tools/VSTestHost/VSTestHost/VSTestContext.cs b/Tools/VSTestHost/VSTestHost/VSTestContext.cs
deleted file mode 100644
index 92ac0077aa..0000000000
--- a/Tools/VSTestHost/VSTestHost/VSTestContext.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-/* ****************************************************************************
- *
- * Copyright (c) Microsoft Corporation.
- *
- * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
- * copy of the license can be found in the License.html file at the root of this distribution. If
- * you cannot locate the Apache License, Version 2.0, please send an email to
- * vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
- * by the terms of the Apache License, Version 2.0.
- *
- * You must not remove this notice, or any other, from this software.
- *
- * ***************************************************************************/
-
-#if SUPPORT_TESTEE
-
-using System;
-
-namespace Microsoft.VisualStudioTools.VSTestHost {
- public static class VSTestContext {
- private static IServiceProvider _serviceProvider;
- private static EnvDTE.DTE _dte;
- private static bool _isMock;
-
- public static IServiceProvider ServiceProvider {
- get {
- if (_serviceProvider == null) {
- throw new InvalidOperationException(Internal.Resources.NoServiceProvider);
- }
- return _serviceProvider;
- }
- set {
- _serviceProvider = value;
- if (_serviceProvider != null) {
- _dte = (EnvDTE.DTE)_serviceProvider.GetService(typeof(EnvDTE.DTE));
- } else {
- _dte = null;
- }
- }
- }
-
- public static EnvDTE.DTE DTE {
- get {
- if (_dte == null) {
- throw new InvalidOperationException(Internal.Resources.NoServiceProvider);
- }
- return _dte;
- }
- }
-
- public static bool IsMock {
- get {
- return _isMock;
- }
- internal set {
- _isMock = value;
- }
- }
- }
-}
-
-#endif
diff --git a/Tools/VSTestHost/VSTestHost/VSTestHost.csproj b/Tools/VSTestHost/VSTestHost/VSTestHost.csproj
deleted file mode 100644
index 59fc5f3218..0000000000
--- a/Tools/VSTestHost/VSTestHost/VSTestHost.csproj
+++ /dev/null
@@ -1,160 +0,0 @@
-
-
-
- 12.0
- 10.0
-
-
-
-
-
- Debug
- AnyCPU
- 2.0
- {5EAD9B97-793D-404E-988E-7A93E7D5F2E8}
- {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- Library
- Properties
- Microsoft.VisualStudioTools.VSTestHost
- Microsoft.VisualStudioTools.VSTestHost.$(VisualStudioVersion)
- bin\$(Configuration)_$(VisualStudioVersion)\
- obj\$(Configuration)_$(VisualStudioVersion)
- true
- ..\..\..\Build\FinalPublicKey.snk
- true
- v4.5
- false
- false
- false
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
- $([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\$(VisualStudioVersion)', 'InstallDir', null, RegistryView.Registry32))\
- false
- prompt
- 4
- SAK
- SAK
- SAK
- SAK
-
-
- true
- full
- false
- DEBUG;TRACE
- true
- true
-
-
- pdbonly
- true
- TRACE
- false
- false
-
-
-
- $(DefineConstants);SUPPORT_TESTEE
-
- $(DefineConstants);SUPPORT_TESTER
-
- $(DefineConstants);PACKAGE_NEEDS_DISPOSE
-
- $(DefineConstants);VS$(VisualStudioVersion.Substring(0, 2))
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {80CC9F66-E7D8-4DDD-85B6-D9E6CD0E93E2}
- 8
- 0
- 0
- primary
- False
- False
-
-
- {00020430-0000-0000-C000-000000000046}
- 2
- 0
- 0
- primary
- False
- False
-
-
-
-
-
-
-
- True
- True
- Resources.resx
-
-
-
-
-
-
- UserControl
-
-
- TesterTestControl.cs
-
-
-
-
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
- Microsoft.VisualStudioTools.VSTestHost.Internal
-
-
- true
- VSPackage
-
-
-
-
- FinalPublicKey.snk
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Tools/VSTestHost/VSTestHost/VSTestHost.csproj.vspscc b/Tools/VSTestHost/VSTestHost/VSTestHost.csproj.vspscc
deleted file mode 100644
index feffdecaa4..0000000000
--- a/Tools/VSTestHost/VSTestHost/VSTestHost.csproj.vspscc
+++ /dev/null
@@ -1,10 +0,0 @@
-""
-{
-"FILE_VERSION" = "9237"
-"ENLISTMENT_CHOICE" = "NEVER"
-"PROJECT_FILE_RELATIVE_PATH" = ""
-"NUMBER_OF_EXCLUDED_FILES" = "0"
-"ORIGINAL_PROJECT_FILE_PATH" = ""
-"NUMBER_OF_NESTED_PROJECTS" = "0"
-"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
-}
diff --git a/Tools/VSTestHost/VSTestHost/VSTestHostPackage.cs b/Tools/VSTestHost/VSTestHost/VSTestHostPackage.cs
deleted file mode 100644
index 147312bdd2..0000000000
--- a/Tools/VSTestHost/VSTestHost/VSTestHostPackage.cs
+++ /dev/null
@@ -1,156 +0,0 @@
-/* ****************************************************************************
- *
- * Copyright (c) Microsoft Corporation.
- *
- * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
- * copy of the license can be found in the License.html file at the root of this distribution. If
- * you cannot locate the Apache License, Version 2.0, please send an email to
- * vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
- * by the terms of the Apache License, Version 2.0.
- *
- * You must not remove this notice, or any other, from this software.
- *
- * ***************************************************************************/
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-using System.Runtime.Remoting;
-using System.Runtime.Remoting.Channels;
-using System.Runtime.Remoting.Channels.Ipc;
-using System.Runtime.Serialization.Formatters;
-using System.Security.Principal;
-using System.Threading;
-using Microsoft.VisualStudio;
-using Microsoft.VisualStudio.Shell;
-using Microsoft.VisualStudio.Shell.Interop;
-using Microsoft.VisualStudio.TestTools.Vsip;
-using Task = System.Threading.Tasks.Task;
-
-namespace Microsoft.VisualStudioTools.VSTestHost.Internal {
- [PackageRegistration(UseManagedResourcesOnly = true, RegisterUsing=RegistrationMethod.Assembly)]
- [InstalledProductRegistration("#110", "#112", "1.0.1", IconResourceID = 400)]
- [ProvideAutoLoad(VSConstants.UICONTEXT.NoSolution_string)]
- [ProvideAutoLoad(VSConstants.UICONTEXT.SolutionExists_string)]
-#if SUPPORT_TESTER
- [RegisterHostAdapter("VSTestHost", typeof(TesterTestAdapter), typeof(TesterTestControl))]
- [RegisterSupportedTestType("VSTestHost", "VS Test Host Adapter", Guids.UnitTestTypeString, "Unit Test")]
-#endif
- [Guid(Guids.VSTestHostPkgString)]
- public sealed class VSTestHostPackage : Package
-#if PACKAGE_NEEDS_DISPOSE
- , IDisposable
-#endif
- {
- private IChannel _channel;
-
- public VSTestHostPackage() { }
-
- #if PACKAGE_NEEDS_DISPOSE
- // Package does not implement IDisposable, so define Dispose
- public void Dispose() {
- {
- #else
- // Package implements IDisposable, so override Dispose
- protected override void Dispose(bool disposing) {
- if (disposing) {
- #endif
- var channel = Interlocked.Exchange(ref _channel, null);
- if (channel != null) {
- ChannelServices.UnregisterChannel(channel);
- }
- }
- }
-
- protected override void Initialize() {
-#if SUPPORT_TESTEE
- // Configure our IPC channel for this process and register any
- // public services. The name is keyed off the module name and
- // process ID so our host can connect to a specific instance.
- _channel = RegisterChannel(GetChannelName(Process.GetCurrentProcess()));
-
- RemotingConfiguration.RegisterWellKnownServiceType(
- typeof(TesteeTestAdapter),
- "vstest",
- WellKnownObjectMode.Singleton
- );
-#endif
-
-#if SUPPORT_TESTER
- // Register our DebugAttacher service so our test adapter can tell
- // us to attach to our client.
- RemotingConfiguration.RegisterWellKnownServiceType(
- typeof(TesterDebugAttacher),
- "debug",
- WellKnownObjectMode.SingleCall
- );
-
- // Register for notifications when we start debugging. This is used
- // so we can start listening for incoming calls to DebugAttacher
- // only when necessary.
- UIContext.FromUIContextGuid(new Guid(UIContextGuids.Debugging)).UIContextChanged += DebuggingChanged;
-#endif
-
- base.Initialize();
-
-#if SUPPORT_TESTEE
- // Initialize the global context used by tests to access VS services
- // and a DTE instance.
- VSTestContext.ServiceProvider = ServiceProvider.GlobalProvider;
- VSTestContext.IsMock = false;
-#endif
- }
-
-#if SUPPORT_TESTER
- async void DebuggingChanged(object sender, UIContextChangedEventArgs e) {
- if (e.Activated) {
- // We just started debugging, so publish the DebugAttacher class
- // and wait for a request.
- IChannel channel;
- EventWaitHandle notifyEvent;
- if (!TesterDebugAttacherShared.OpenChannel(10, out channel, out notifyEvent)) {
- return;
- }
- try {
- // Wait for the signal that we've either attached to our
- // client, or we've aborted the wait. All we do after this
- // is unregister the channel, so it doesn't really matter
- // which it is.
- var signaled = await Task.Run(() => notifyEvent.WaitOne(TimeSpan.FromSeconds(30)));
- } finally {
- notifyEvent.Dispose();
- TesterDebugAttacherShared.CloseChannel(channel);
- }
- } else {
- // We were debugging, but now we've stopped
-
- // Abort waiting in case we stopped within the timeout
- TesterDebugAttacherShared.CancelWait();
- }
- }
-#endif
-
- public static string GetChannelName(Process process) {
- return string.Format("VSTestHost_{0}_{1:X8}_06420E12_C5A1_4EEF_B604_406E6A139737",
- process.MainModule.ModuleName.ToLowerInvariant(),
- process.Id
- );
- }
-
- internal static IChannel RegisterChannel(string name) {
- var properties = new Dictionary {
- { "name", name },
- { "portName", name },
- { "authorizedGroup", WindowsIdentity.GetCurrent().Name }
- };
-
- var serverProvider = new BinaryServerFormatterSinkProvider();
- serverProvider.TypeFilterLevel = TypeFilterLevel.Full;
-
- var channel = new IpcServerChannel(properties, serverProvider);
- ChannelServices.RegisterChannel(channel, false);
- return channel;
- }
- }
-}
diff --git a/Tools/VSTestHost/VSTestHost/VisualStudio.cs b/Tools/VSTestHost/VSTestHost/VisualStudio.cs
deleted file mode 100644
index e5c52e5d79..0000000000
--- a/Tools/VSTestHost/VSTestHost/VisualStudio.cs
+++ /dev/null
@@ -1,277 +0,0 @@
-/* ****************************************************************************
- *
- * Copyright (c) Microsoft Corporation.
- *
- * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
- * copy of the license can be found in the License.html file at the root of this distribution. If
- * you cannot locate the Apache License, Version 2.0, please send an email to
- * vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
- * by the terms of the Apache License, Version 2.0.
- *
- * You must not remove this notice, or any other, from this software.
- *
- * ***************************************************************************/
-
-#if SUPPORT_TESTER
-
-using System;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Threading;
-using System.Threading.Tasks;
-using EnvDTE;
-using Microsoft.VisualStudio.OLE.Interop;
-using Microsoft.VisualStudio.Shell;
-using Microsoft.Win32;
-using Process = System.Diagnostics.Process;
-using Task = System.Threading.Tasks.Task;
-using Thread = System.Threading.Thread;
-
-namespace Microsoft.VisualStudioTools.VSTestHost.Internal {
- class VisualStudio : IDisposable {
- private readonly Version _version;
- private readonly int _processId;
- private readonly bool _killOnDispose;
- private DTE _dte;
-
- public VisualStudio(int processId, Version version, bool killOnDispose = false) {
- _processId = processId;
- _version = version;
- _killOnDispose = killOnDispose;
- }
-
- protected virtual void Dispose(bool disposing) {
- MessageFilter.Revoke();
- if (_killOnDispose) {
- try {
- Process.GetProcessById(_processId).Kill();
- } catch (ArgumentException) {
- } catch (InvalidOperationException) {
- } catch (Win32Exception) {
- }
- }
- }
-
- ~VisualStudio() {
- Dispose(false);
- }
-
- public void Dispose() {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- public int ProcessId {
- get { return _processId; }
- }
-
- public static async Task LaunchAsync(
- string application,
- string executable,
- Version version,
- string hive,
- CancellationToken cancel
- ) {
- var installDir = GetInstallDir(application, version, hive);
- if (!Directory.Exists(installDir)) {
- throw new DirectoryNotFoundException("Cannot find Visual Studio install path");
- }
-
- var devenv = Path.Combine(installDir, executable);
- if (!File.Exists(devenv)) {
- throw new FileNotFoundException("Cannot find Visual Studio executable");
- }
-
- var psi = new ProcessStartInfo(devenv);
- if (!string.IsNullOrEmpty(hive)) {
- psi.Arguments = "/rootSuffix " + hive;
- }
-
- cancel.ThrowIfCancellationRequested();
- var process = Process.Start(psi);
-
- await Task.Run(() => process.WaitForInputIdle(), cancel);
-
- var vs = new VisualStudio(process.Id, version, true);
- try {
- while (true) {
- cancel.ThrowIfCancellationRequested();
- if (vs.DTE != null) {
- return Interlocked.Exchange(ref vs, null);
- }
- await Task.Delay(1000, cancel);
- }
- } finally {
- if (vs != null) {
- vs.Dispose();
- }
- }
- }
-
- private static string GetInstallDir(string application, Version version, string hive) {
- using (var root = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32))
- using (var key = root.OpenSubKey("Software\\Microsoft\\" + application)) {
- if (key == null) {
- return null;
- }
-
- string installDir;
-
- using (var subkey = key.OpenSubKey(version.ToString())) {
- if (subkey == null) {
- return null;
- }
-
- installDir = subkey.GetValue("InstallDir") as string;
- }
-
- if (!Directory.Exists(installDir)) {
- return null;
- }
-
- return installDir;
- }
- }
-
- public DTE DTE {
- get {
- if (_dte == null) {
- _dte = GetDTE(_processId, _version);
- }
- return _dte;
- }
- }
-
- public T GetService(Type type = null) where T : class {
- var sp = ((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)DTE);
- return new ServiceProvider(sp).GetService(type ?? typeof(T)) as T;
- }
-
- // Source from
- // http://blogs.msdn.com/b/kirillosenkov/archive/2011/08/10/how-to-get-dte-from-visual-studio-process-id.aspx
- [DllImport("ole32.dll")]
- private static extern int CreateBindCtx(uint reserved, out IBindCtx ppbc);
-
- private static DTE GetDTE(int processId, Version version) {
- MessageFilter.Register();
-
- var process = Process.GetProcessById(processId);
- string progIdName = "VisualStudio";
-
- switch (process.MainModule.ModuleName.ToLowerInvariant()) {
- case "wdexpress.exe":
- progIdName = "WDExpress";
- break;
- case "vwdexpress.exe":
- progIdName = "VWDExpress";
- break;
- }
-
- string progId = string.Format("!{0}.DTE.{1}:{2}", progIdName, version, processId);
- object runningObject = null;
-
- IBindCtx bindCtx = null;
- IRunningObjectTable rot = null;
- IEnumMoniker enumMonikers = null;
-
- Marshal.ThrowExceptionForHR(CreateBindCtx(reserved: 0, ppbc: out bindCtx));
- bindCtx.GetRunningObjectTable(out rot);
- rot.EnumRunning(out enumMonikers);
-
- IMoniker[] moniker = new IMoniker[1];
- uint numberFetched = 0;
- while (enumMonikers.Next(1, moniker, out numberFetched) == 0) {
- IMoniker runningObjectMoniker = moniker[0];
-
- string name = null;
-
- try {
- if (runningObjectMoniker != null) {
- runningObjectMoniker.GetDisplayName(bindCtx, null, out name);
- }
- } catch (UnauthorizedAccessException) {
- // Do nothing, there is something in the ROT that we do not have access to.
- }
-
- if (!string.IsNullOrEmpty(name) && string.Equals(name, progId, StringComparison.Ordinal)) {
- rot.GetObject(runningObjectMoniker, out runningObject);
- break;
- }
- }
-
- return (DTE)runningObject;
- }
-
- public class MessageFilter : IOleMessageFilter {
- // Start the filter.
- public static void Register() {
- IOleMessageFilter newFilter = new MessageFilter();
- IOleMessageFilter oldFilter = null;
- CoRegisterMessageFilter(newFilter, out oldFilter);
- }
-
- // Done with the filter, close it.
- public static void Revoke() {
- IOleMessageFilter oldFilter = null;
- CoRegisterMessageFilter(null, out oldFilter);
- }
-
- const int SERVERCALL_ISHANDLED = 0;
- const int SERVERCALL_RETRYLATER = 2;
- const int PENDINGMSG_WAITDEFPROCESS = 2;
-
- private MessageFilter() { }
-
- // IOleMessageFilter functions.
- // Handle incoming thread requests.
- int IOleMessageFilter.HandleInComingCall(int dwCallType,
- IntPtr hTaskCaller,
- int dwTickCount,
- IntPtr lpInterfaceInfo) {
- return SERVERCALL_ISHANDLED;
- }
-
- // Thread call was rejected, so try again.
- int IOleMessageFilter.RetryRejectedCall(IntPtr hTaskCallee, int dwTickCount, int dwRejectType) {
- if (dwRejectType == SERVERCALL_RETRYLATER && dwTickCount < 10000) {
- // Retry the thread call after 250ms
- return 250;
- }
- // Too busy; cancel call.
- return -1;
- }
-
- int IOleMessageFilter.MessagePending(System.IntPtr hTaskCallee, int dwTickCount, int dwPendingType) {
- return PENDINGMSG_WAITDEFPROCESS;
- }
-
- // Implement the IOleMessageFilter interface.
- [DllImport("Ole32.dll")]
- private static extern int CoRegisterMessageFilter(IOleMessageFilter newFilter, out IOleMessageFilter oldFilter);
- }
-
- [ComImport(), Guid("00000016-0000-0000-C000-000000000046"),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
- interface IOleMessageFilter {
- [PreserveSig]
- int HandleInComingCall(int dwCallType,
- IntPtr hTaskCaller,
- int dwTickCount,
- IntPtr lpInterfaceInfo);
-
- [PreserveSig]
- int RetryRejectedCall(IntPtr hTaskCallee,
- int dwTickCount,
- int dwRejectType);
-
- [PreserveSig]
- int MessagePending(IntPtr hTaskCallee,
- int dwTickCount,
- int dwPendingType);
- }
- }
-}
-
-#endif
diff --git a/Tools/VSTestHost/VSTestHost/source.extension.vsixmanifest b/Tools/VSTestHost/VSTestHost/source.extension.vsixmanifest
deleted file mode 100644
index 3bda2de82a..0000000000
--- a/Tools/VSTestHost/VSTestHost/source.extension.vsixmanifest
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
- VSTestHost
- Allows UI testing of the Visual Studio IDE.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-