Currently FrameworkAdapter.CreateInstance() tries to determine whether MSTest or NUnit is being used by recursively enumerating types in all referenced assemblies in the AppDomain. This is not a very good idea for two reasons: 1) it is very slow, 2) sometimes not all types of currently loaded assemblies can actually be enumerated because they reference types in other assemblies that are not accessible (Assembly.GetExportedTypes() can throw!). This can happen if a dependent assembly is missing (but not otherwise needed).
This code should really just look at the list of AssemblyReferences and make a determination based on the name of the referenced assembly. There is no need to dig down deeper to enumerate all types.
Moreover, it should catch and ignore exceptions related to assemblies or types that cannot be loaded.
In addition, it would be nice to be able to configure/disable whether csUnit considers foreign framework adapters. For example, when Gallio calls into csUnit it already knows that the test assembly belongs to csUnit (because it references csUnit.dll). It does not need csUnit to further try to emulate MSTest and NUnit because those frameworks are already supported natively by other plugins.
Log in to post a comment.