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:
- To isolate the call in it's own thread, and get the dispatcher to invoke the stop inside, and them abort the thread.
- 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.