简体   繁体   中英

DisconnectedContext error when running Unit Tests in debug in VS2015

I have this problem with running unit tests in VS2015 Enterprise. Whenever I run any unit test in debug mode, I get the following error:

Managed Debugging Assistant 'DisconnectedContext' has detected a problem in 'my_path_to_VS\\COMMON7\\IDE\\COMMONEXTENSIONS\\MICROSOFT\\TESTWINDOW\\te.processhost.managed.exe'.

I tried running repair on VS2015 and it did not help. Tried uninstalling and installling again and the issue persist. The strange thing that I have a code on SVN and my friend in able to run the same code in debug on his machine without any issues.

Just running the test (without debugger) works without any problems.

I do have a ReSharper installed. Could that be causing this issue?

UPDATE Ok so Resharper is causing this issue. This issue only happens when I am running the test through the ReSharper icon (next to the TestMethod name). When I do Test->Debug->All Tests it runs fine. Any ideas? Maybe ReSharper bug?

I also have Rashaper and faced with this problem, no matter from where I am calling the tests (VS or Resharper). I've overcome this by changing the target architecture of the tests and the projects to the x64. But the source of the problem is still unknown for me. 设定值

I had this exception while debugging a WCF service in Visual Studio 2015. No usage of ReSharper. Changing the default architecture as suggested by shfire to X64 fixed it for me.

Because my project is a migrated Visual Studio 2012 project I compared the default processor architecture with the settings in VS2012. In VS2012 the default architecture isn't selected or selectable! I think this is a new bug and/or feature of VS2015 ;-)

Check if you set the compiler to "Release" instead of "Debug". That solved the issue for me!

Similar issue here. Fixed-it I don't know how : Set the target system as x64 from Any CPU. Run "debug all tests" => no tests where found. (?) Tryed to manualy run debug on my empty first test, apparently no action. Got back from x64 to Any CPU.

Now it works ... Hope it helps.

This exception also occurs if you have installed CodeRush for Roslyn Preview extension in VS2015. This extension have some functionality for unit testing, so it appears that this is common for all extensions which extend to unit testing in Visual Studio. Can be solved by uninstalling (not disabling) this extension.

I had similar problem, my unit tests used external application run in new process. I run visual studio in administrator mode and it resolved problems.

I've been getting this problem doing ordinary debugging (using Visual Studio 2015, of a Windows Forms application, which was a first project first created using earlier versions of Visual Studio). It happens occasionally.

I think it may be related to Enable the Visual Studio hosting process in the project's Debug properties page, ie I hope that disabling that option will prevent this problem.

I was receiving the same error while using the following:

System.Threading.Tasks.Task.Factory.StartNew(
  Sub()
    Do
        Me.BeginInvoke(Sub()
           TimeTextBox.Text = Now.ToString("HH:mm:ss")                                               
                       End Sub)
        ' thread not a problem
        System.Threading.Thread.Sleep(1500)
        ' Task delay fail with disconnection
        'System.Threading.Tasks.Task.Delay(1500)
    Loop While isrunning
  End Sub)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM