-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to instrument module - due to Microsoft.Extensions.DependencyInjection.Abstractions #1102
Comments
Looks to me like this known issue. Could you try a |
Also as another workaround(if publish doesn't work) you could add direct reference of that lib(same version) to test project. |
Running However publish puts it's output in: But publishing to the same folder, with @MarcoRossignoli: Unfortunately it didn't work by reference Microsoft.Extensions.DependencyInjection.Abstractions direct in test project. The Microsoft.Extensions.DependencyInjection.Abstractions.dll is not copied to output directory even if it's referenced(!). |
Update: We fixed this by placing the |
I am having the same issue in both .net 5 and .net 6. I tried a bunch of steps to debug this further. If I copied the Microsoft.Extensions.DependencyInjection.Abstractions.dll (v6.0.0) from the Release\net6.0\refs folder to the Release\net6.0 folder I would then get this error when running the tests (not from the diagnostic logs):
What is interesting about this is that it is complaining about version 2.2.0.0 which is not referenced directly anywhere in my projects. In the end, after trying all the suggestions above, the only thing that eventually worked was the 2nd Workaround suggested by @LeVraiSylvain of copying this assembly into the root folder of the test project. Not too happy with this hack but things must go on. |
To make this work you need proper In depth - Microsoft.Extensions.DependencyInjection.Abstractions assembly on generic build become conflicted between:
and Reference
So on GenerateBuildDependencyFile msuild target they will be just skipped
When you publish your output folder there are no Copy local assemblies so there are no conflict and |
This issue is stale because it has been open for 3 months with no activity. |
This issue was closed because it has been inactive for 9 months since being marked as stale. |
I try to run coverage with a .Net 5 NUnint test project using Coverlet collector 3.0.3. The project is not producing coverage project under test but for referenced class libraries there are coverage.
I'm running the following command:
dotnet test <MY_TEST_PROJECT> --collect:"XPlat Code Coverage" --diag:log.txt
When examining the data collector log it seems to be related to Microsoft.Extensions.DependencyInjection.Abstractions is missing:
(A lot more of the first kind of log
Cannot find reference assembly 'X.dll' file for package Y
.)I've tried to add
<PreserveCompilationContext>true</PreserveCompilationContext>
but it didn't help.The only thing helping has been to manually copy the file
Microsoft.Extensions.DependencyInjection.Abstractions.dll
to the same path as test dll/Users/sensitive_path/bin/Debug/net5.0/
. That generates coverage for project under test as well.Any advise what I'm doing wrong? I can provide more logs if necessary (just have to wash out some sensitive data)
The text was updated successfully, but these errors were encountered: