Alexander Pacha
Alexander Pacha

Reputation: 9750

Attach Visual Studio debugger to VS IDE Host

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:

Upvotes: 0

Views: 217

Answers (1)

Jack Zhai
Jack Zhai

Reputation: 6436

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

Upvotes: 1

Related Questions