I am trying to test an application that is using the Visual Studio 2015 Shell (Isolated).
For testing the extension package with Visual Studio, I found samples for older versions. They look like this:
[TestMethod]
[HostType("VS IDE")]
public void CreateVisualization()
{
TestUtils testUtils = new TestUtils();
testUtils.CloseCurrentSolution(__VSSLNSAVEOPTIONS.SLNSAVEOPT_NoSave);
testUtils.CreateProjectFromTemplate(TestContext.TestDir, "MyProjectType", "MyProjectType.zip");
testUtils.CloseCurrentSolution(__VSSLNSAVEOPTIONS.SLNSAVEOPT_NoSave);
}
My problem is that I can not debug those tests, because the debugger does not attach to the VS IDE
host process. Once, I remove the HostType-annotation, I can set breakpoints and debug it, but then the test does not run inside the correct process. I verified that the attaching does not work, by writing an endless-loop inside the test and then manually attaching to the started process (which would enable the debugging).
Is there any way to automatically attach the Visual Studio debugger to the started process upon starting the test, so I can debug without the manual "Attach to process"-step?
Edit:
I've tried several solutions, but nothing worked so far:
- How to host VS IDE during integration test via MSTest? started Visual Studio but not my application
- Visual Studio: auto attach to a process when the process is spawned had mixed results.
Debugger.Launch
works, but still requires the tedious "Select Debugger ..." dialog to be accepted - Microsoft's own suggested way to automatically attach the debugger does not work, as it always launches the jit-debugger when starting the application, not only when running (and debugging) the tests.