0
votes

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:

1
Another thing you can try is the Child Process Debugging Tool.Patrick Nelson - MSFT
@Alexander Pacha, I also share a solution, is it helpful? Do you resolve this issue?Jack Zhai-MSFT
See my edit: I've already tested all the solutions, that you've posted (before you posted them). So far, none of them worked really well for the particular problem of attaching to the VS IDE Host adapter. But I value your effort anyway.Alexander Pacha

1 Answers

1
votes

If you want to set Debugger to auto attach on Process which will start, you can use the Registry Editor, but it is not convenient:

https://msdn.microsoft.com/en-us/library/a329t4ed(v=vs.100).aspx

A simple way is that you could use this tool wrote by Eyal Rosner here:

http://www.codeproject.com/Articles/1090417/How-to-Set-Debugger-to-Auto-Attach-on-Process-Star

It is easy for us to set the Registry Editor.

enter image description here