I am writing a C# unit test to test C++/CLI functionality that involves threads.
The C++/CLI code implements a DirectShow filter, the Windows API for rendering movies. This works thus that I create DirectShow objects, I tell it to run an AVI through my C++/CLI filters, waits until rendering is done, and then exits. My filter has a callback that gives the video frames to C# for processing. DirectShow works thus that it creates its own thread and calls my COM objects from this thread.
Now, this stuff works when I run my code normally, but when running a unit test from Resharper it fails with the error "Cannot pass a GCHandle across AppDomains".
What appears to go wrong is that Resharper uses AppDomains in its testrunner, and the DirectShow thread is somehow not associated with this appdomain.
So how do I make this test work from Resharper? Is there a NUnit/Resharper setting to control if appdomains are used? Can I tell the CLR somehow that a thread is assocated with a particular appdomain? Do you know any other pragmatic workarounds?
TIA Jan