Hi Sly,
> Thanks a lot for your quick response. I have submitted the
> bug. Its ID is 2455688.
Got it.
> The reason why I need the /domain=none option is the
> following. Our software uses a dedicated event mechanism
> written in C++, which is implemented in our infrastructure
> library (a framework that all of our software modules use).
> In order to be able to use these events in the .NET world, a
> "C++ events to .NET bridge" has been implemented.
> This bridge is implemented in managed C++. This bridge works
> fine, but we found out that NUnit tests that use this event
> bridge fail due to the following error: "Cannot pass a
> GCHandle across AppDomains". If I understand it correctly,
> NUnit by default creates an AppDomain per test assembly. It
> seems that Microsoft C++ has its own AppDomain for unmanaged
> code and that GCRoot does not allow marshaling across AppDomains.
>
> The problem is kind of identical to what is written here:
>
http://social.msdn.microsoft.com/Forums/en-US/vststest/thread/
> fc7bc074-ff05-407b-b646-d9e5532c6998.
It sure sounds similar, but it doesn't entirely make sense to me.
Why is this setup...
Primary AppDomain => Test AppDomain => C++ AppDomain
any different from this...
Primary AppDomain (with tests) => C++ AppDomain
since there's a cross-domain operation in either case?
> Since we don't have any use case for which we need to support
> multiple AppDomains, we decided to use the /domain=none
> option. However, it turned out that this sometimes causes a
> deadlock when executing Console.WriteLine( ).
Can you provide a simplified test case for this? You can attach
it to the bug.
> Besides just removing all ConsoleWriteLines from my test code
> as a workaround, do you have any other suggestions?
I'll need to understand this better first. It seems like a key
issue, if we want to adequately support C++.
Charlie