Sep 18 2009

DisconnectedContext when debugging with MSTest

Category: .NetRory Primrose @ 10:42

I have been hitting a DisconnectedContext issue when I’ve been running MSTest in the Visual Studio IDE with the debugger attached. At first I thought it was an issue with debugging WF, but it is now also happening with LINQ to SQL.

image

The debugging on the thread of the executing test appears to be stopped when this is hit. Other threads/tests in the test run will still hit breakpoints however.

Searching the net hasn’t yielded any pointers. Anyone out there have some information about this?

Tags: ,

Comments

1.
Aatif Aatif United Kingdom says:

Hi,

I am having similar issue, I am calling AD functions using DirectoryServices 3.5, and by looking at different resources (stackoverflow.com/.../disconnectedcontext-error-while-running-unit-test-project-in-vs-2008 is one of them), it resolved when I changed it to MTA by adding following line in LocalTestRun.testrunconfig.

<ExecutionThread apartmentState="1"/>

I am still looking at it, but if you have any thoughts then please let me know.

2.
shawn barrett shawn barrett United Kingdom says:

You only get this in debug mode (Along with other COM related exceptions - NonComVisibleBaseClass etc.). You could simply F5 to continue or uncheck exception in managed Debugging Assistant. Accessed via Debug->Exceptions menu in VS.

3.
Rory Primrose Rory Primrose Australia says:

Thanks Shawn. This was also suggested to me via a friend. Unfortunately I haven't had the chance to test it out. Any idea of any impact of ignoring the exception in debug mode as you have indicated?

Thanks for the follow up.

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading