Closed bradwilson closed 4 years ago
Here is a gist with the output from COREHOST_TRACE=1
: https://gist.github.com/bradwilson/bf2e06679cd0992416e8654b618cf6d1
/tag @eerhardt on the advice of Nate McMaster
The xunit.runner.utility.netcoreapp10
assembly is not listed in the .deps.json file of the test, which is why it is failing to load.
This was an explicit bug fix/change from netcoreapp1.0 to netcoreapp1.1. It was a bug in 1.0 that assemblies in the app folder were getting loaded without being in the .deps.json file.
I think the issue that fixed it was https://github.com/dotnet/core-setup/issues/193, but @gkhanna79 and @ramarag would know exactly which one it was.
To fix this, either:
It was a bug in 1.0 that assemblies in the app folder were getting loaded without being in the .deps.json file.
🤔 Interesting.... I was under the impression this was how it was supposed to work.
Any file with the suffix .dll in the same folder as the managed application being loaded (the "Application Base") will be considered a viable assembly during the resolution process.
Yes, that is an incorrect statement that should have been fixed but was not. @ramarag Can you please update the document?
@eerhardt Do you have any documentation/examples of how I would implement an AssemblyLoadContext
?
@gkhanna79 Thanks!
Closing now, since this is expected behavior.
@gkhanna79 I'm unclear after reading the documentation as to how you replace the default load context (since the things that are failing to load are implicit dependencies). How is this achieved?
I made it work using the default load context's Resolving event. Thanks!
Background
I work on xUnit.net. I'm writing a console test runner which is deployed as a .NET CLI command line tool.
The runner shim works by finding the unit test DLL (after building), and then issuing a
dotnet exec
to run a .NET Core port of our console runner, based on code and help I've gotten from @natemcmaster. In order to ensure that everything is loadable, I copy all the DLLs for the runner and its supporting libraries into thebin
folder, and then run thedotnet exec
using thatbin
folder as the working directory (code here). That allows me to implicitly load my runner and support libraries without having them be linked into the unit test project.This strategy is working for
netcoreapp1.0
projects, but one of my support DLLs is failing to load withnetcoreapp1.1
. The DLL that fails to load is present in thebin
folder. I asked Nate to look over my execution logs, but he didn't find anything.Steps to reproduce
v2x_netcoreapp1.0
folder, rundotnet restore
, thendotnet xunit
. The tests should run successfully (there is one failing test). Output looks like this:v2x_netcoreapp1.1
folder, rundotnet restore
thendotnet xunit
. The tests fail to run with aFileNotFoundException
:All the DLLs I expect to be in the bin folder are there, including the one that would not load:
Expected behavior
Tests run successfully.
Actual behavior
Tests fail to run because of
FileNotFoundException
.Environment data