NuPattern solution will not debug Integration tests in VS2012


It seems that debugging integration tests [HostType("VS IDE")] in VS2012 will not hit any breakpoints.
For example any of the integration tests in 'Runtime.IntegrationTests'.
Unit tests and CodedUI Tests can be debugged just fine.
However, breakpoints ARE hit fine in the same integration tests when the code is compiled and tests are run in VS2010!
The problem, whatever it is, seems to be limited to integration tests only, in VS2012 only.

For integration tests, the breakpoint is always hollow, and it reports that 'no symbols have been loaded for this document' (tooltip on the breakpoint). THe breakpoint is ignored and the test completes without breaking.

According to the 'Debug' pane in the Output window, the assembly containing the code, is loaded and 'Symbols loaded'. And each test is traced through in this window. But there is an entry like this after the test has finished running:
'A first chance exception of type 'System.Runtime.InteropServices.InvalidComObjectException' occurred in Microsoft.VSSDK.TestHostAdapter.dll'

The 'Tests' pane in the Output Window reports that the debugger is launched successfully (multiple times) and some missing sub-dependencies which are thought not to be related.

The *.testsettings files for both VS2010 and VS2012 are near identical.

I also recall that the breakpoints ARE hit when debugging using the Resharper Unit Testing framework in VS2012, which indicates that the problem may be with MSTEST in VS2012?

The workaround for the time being is to write modify the tests in VS2010, but this is not a reliable long term resolution.
Closed Jan 25, 2014 at 7:06 PM by jezzsa
Microsoft will not fix (since VS2010). Found suitable workaround


jezzsa wrote Jan 25, 2014 at 7:06 PM

Finally confirmed today that this is a commonly experienced problem for all extension development since Visual Studio 2010.

In versions of VS later than VS2010, you cannot debug extensions from integration tests.
(Must be a bug Microsoft is aware of, but the VSIX development community must be that small that few people are expected to be impacted enough to want to fix it properly.

  1. Open the solution in VS2010, set breakpoint in integration test. The breakpoint will hit as normal.
  2. The old fashioned (ANSI C development method) in the code you want to test write in this statement: