when unit-testing using MSTest, I create a WPF window. When this window closes, Visual Studio shows InvalidComObjectException
:
COM object that has been separated from its underlying RCW cannot be used.
it is raised after the [TestMethod]
exits, and the stack contains only external code (no InnerException
). This is what I have:
StackTrace:
at System.Windows.Input.TextServicesContext.StopTransitoryExtension()
at System.Windows.Input.TextServicesContext.Uninitialize(Boolean appDomainShutdown)
at System.Windows.Input.TextServicesContext.TextServicesContextShutDownListener.OnShutDown(Object target, Object sender, EventArgs e)
at MS.Internal.ShutDownListener.HandleShutDown(Object sender, EventArgs e)
DeclaringType:
{Name = "TextServicesContext" FullName = "System.Windows.Input.TextServicesContext"}
Assembly:
{PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35}
And this is the code that creates the window:
var myWindow = new SomeWindow(errors);
myWindow.ShowDialog();
The window contains two ListView
s with some text elements and check-boxes in them