I am having an issue (i.e. ReflectionTypeLoadExceptions) with assembly loading in a netcore3.1 application, specifically when using "NUnit.ConsoleRunner.NetCore --version 3.12-beta2" to load unit test assemblies which depend on other assemblies, CopyLocal is set to false for the project-references, although all assemblies are in the same directory.
When CopyLocal is set to false for a particular reference, the .deps.json file will not contain all the entries required for the dependee to be loaded by the AssemblyLoadContext directly, and so the AssemblyLoadContext.Resolving callback/event is fired, but not handled in nunit, or handled incorrectly. The ReflectionTypeLoadException is thrown later, when nunit calls assembly.GetTypes().
A simple demo of the issue can be found here: https://github.com/Ian144/NunitAssemblyLoadIssue.git, that includes a console-app that uses a custom AssemblyLoadContext to demonstrate the issue, or if "NUnit.ConsoleRunner.NetCore --version 3.12-beta2" is installed, just run "nunit AssemblyA.dll" from the output directory. In the demo, AssemblyA contains nunit tests, and has a project reference to AssemblyB with copyLocal set to false.
So, is there an issue with the nunit netcore runner, which should be handling the AssemblyLoadContext.Resolving event? or is there a different way to get assembly loading working under this circumstance?
thanks, Ian