Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
This occurs on this version of Mono:
Mono JIT compiler version 3.12.0 (tarball Mon Jan 19 15:51:05 GMT 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
LLVM: supported, not enabled.
As reported here: https://github.com/xunit/xunit/issues/158
The issue is that Mono throws a TypeLoadException on this line of code: https://github.com/xunit/xunit/blob/a76be923dc3761ff6ae15445f7db358e6a2ae595/src/xunit.runner.utility/Frameworks/v2/Xunit2Discoverer.cs#L55
In this case, "Framework.GetDiscoverer" has a return signature of ITestFrameworkDiscoverer, and assigns to a field of type ITestFrameworkDiscoverer. The framework object is a MarshalByRefObject that points to an object in a different AppDomain. The assembly that defines ITestFrameworkDiscoverer is loaded in the current AppDomain, but the concrete class is in a different assembly that is not loaded (and is not on a path that will cause it to automatically load).
Under .NET this works fine, and the CLR only needs to know the interface (because the concrete class is never accessed by any mechanism other than the interface's methods, and is never cast).
Under Mono however, it attempts to load the concrete class as it's returned from the AppDomain, thus causing a TypeLoadException when the assembly that contains it is not available (intentionally as the desire is to only communicate by agreed interfaces).
After applying the commits in
the assert unit tests run correctly.