Unit Tests Which Show Windows Cause VsTestHost/MsTest ShutDown Crashes in VS 2008 RTM - by ScottJ1s

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 318333 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 12/17/2007 4:17:58 PM
Access Restriction Public


I have a project with several unit tests that require windows/dialogs to be displayed in order to exercise my WPF-based classes.  Until VS 2008 RTM (i.e., with Beta 1 and Beta 2), these tests all passed successfully.  In VS 2008 RTM, the test host (whether VsTestHost or MsTest) both crash on shutdown, with the exception message: "COM object that has been separated from its underlying RCW cannot be used."  This is a blocking issue in that the test host also returns a non-zero exit code, causing failed automated builds (even though all the tests in fact pass).  The only solution we've found is to remove the failing tests.

Note: A similar problem was reported earlier with VS 2005, under ID 97820.
Sign in to post a comment.
Posted by aniketT on 6/26/2008 at 1:28 AM
Hi I'm too facing the same issue just difference here is that I'm using NUnit ! but if I use the workaround above then the next test case starts failing and complaining dispatcher is not started !!!!!! Any solution on this ?

Posted by aniketT on 6/26/2008 at 1:26 AM

Posted by ScottJ1s on 1/10/2008 at 3:24 PM
Yes, adding the TestCleanup call did the trick. Thank you!
Posted by Microsoft on 1/10/2008 at 2:26 PM
Thank you for providing a repro for this issue. Can you please try implementing the following work around: in your test class, add the following cleanup method (or add this code to an existing cleanup method):

        public void CleanUp()

Thank you,
Visual Studio Product Team
Posted by Microsoft on 12/19/2007 at 12:45 AM
Thanks for your response. We are escalating this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Thank you,
Visual Studio Product Team
Posted by ScottJ1s on 12/18/2007 at 10:58 AM
Please see attachments for additional info. Test project represents minimal steps need to repro in our organization - an empty C# console app with a single test case that creates and shows a WPF Window. JPG shows results of running the single test case from within the IDE.
Posted by Microsoft on 12/18/2007 at 1:56 AM
Thanks for reporting the issue.
In order to fix the issue, we must first reproduce the issue in our labs. We are unable to reproduce the issue with the steps you provided.
It may help if you provide us with:

1. more exact steps to repro the issue
2. more snapshots.

If we do not receive a response from you after 7-days , we will automatically close your issue. There is no obligation to respond -- at any time you may edit your issue via Connect and change the status to “Active.”

Thank you,
Visual Studio Product Team