Description
Description
My project is injecting an external library as a dependency for the CoreCLR profiler. It uses ADDITIONAL_DEPS environment variable to achieve that. Everything works well as long as ASP.NET Core 2.0 web application is profiled, but if I use exactly the same workflow with ASP.NET Core 2.1 my library is not found by the application.
Diagnostics
This is what I have already tried:
- profiling .NET Core 2.0 application - OK
- profiling ASP.NET Core 2.0 application - OK
- profiling .NET Core 2.1 application - OK
- profiling ASP.NET Core 2.1 application using ADDITIONAL_DEPS env var - FAILURE
- profiling ASP.NET Core 2.1 application using --additional-deps switch - FAILURE
In each of these cases, I was using the same deps.json file and dependent library.
I have found out using procmon.exe that in case of ASP.NET Core 2.1 dotnet.exe behaves differently than in other cases. Dependent assembly is NOT looked up in a location provided in *.deps.json file, but only in the profiled application directory.
Output from dottest.exe is as follows:
An assembly specified in the application dependencies manifest (hooks.deps.json) was not found:
package: 'hooks', version: '1.0.0.0'
path: 'C:/Program Files/Profiler/bin/hooks.dll'
I have double-checked assembly exists in this location.
And this is my *.deps.json file:
{
"runtimeTarget": {
"name": "hooks"
},
"targets": {
"hooks": {
"hooks/1.0.0.0": {
"runtime": {
"C:\\Program Files\\Profiler\\bin\\hooks.dll": {}
}
}
}
},
"libraries": {
"hooks/1.0.0.0": {
"type": "reference",
"serviceable": false,
"sha512": ""
}
}
}
Questions
1. How can I use additional-deps with ASP.NET Core 2.1 properly?
2. Is there some other way to inject external assembly to ASP.NET Core application?
3. Is there at least a workaround for this issue?