windows-user-action-hook icon indicating copy to clipboard operation
windows-user-action-hook copied to clipboard

Unit Testing frameworks report System.AppDomainUnloadedException

Open JavierJF opened this issue 8 years ago • 0 comments

In all the situations I have try to use the MouseWatcher inside a unit test, the testing framework (NUnit, xUnit) reports a this exception:

System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain.

First guess is that, calling MouseWatcher.Stop(), doesn't stop all the running threads that it should.

I have tried:

  1. To isolate the call in it's own thread, and get the dispatcher to invoke the stop inside, and them abort the thread.
  2. To give that thread STA Apartment State, and the IsBackground property.

Nothing has worked yet. At the moment you call MouseWatcher.Start() you get the cited exception at the end of the test.

Thanks you.

JavierJF avatar Jun 10 '17 09:06 JavierJF