-
Notifications
You must be signed in to change notification settings - Fork 387
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
TypeLoadException error (DependencyInjection) with latest EFCore #1390
Comments
Yes, we have the same issue, I can confirm that we also updated all Microsoft & EF Core packages today, however, I haven't check if it is related as our pipelines didn't break. But if @leodip has it already figured out, that EF Core is the issue, it is most likely same reason for us. |
Actually, I think it's Microsoft.Extensions.DependencyInjection 6.0.1 that is problematic (as a dependency of both EF Core and coverlet). Downgrading to 6.0.0 solved the problem in our Azure pipelines. |
Got the same issue. When calling dotnet test with --collect:XPlat Code Coverage I get the error
It must be related to DependencyInjection 6.0.0 not being present in our project anymore. Funnily enough when using CollectCoverage=true in dotnet test, which causes it to use msbuild it didnt have that issue. |
Could somebody try to provide a simple repro for that? I just tried it myself with a simple console app referencing |
Also tried now but it doesn't seem to be that easy to reproduce it. I just included EntityFrameworkCore as I did in the other project and used WebApplicationFactory for testing as well but i couldn't see the issue either. |
Same here and definitely related to .NET 6.0.10, but not directly to EF Core. Seems like the ServiceCollection class was been moved from Microsoft.Extensions.DependencyInjection.dll into Microsoft.Extensions.DependencyInjection.Abstractions.dll. Maybe it happens because coverlet.console still targets net5.0.
|
Happens because of the updated Microsoft.Extensions.DependencyInjection NuGet package (now version 6.0.1). This results in a newer Microsoft.Extensions.DependencyInjection.dll being copied to the bin folder (still assembly version 6.0.0.0). If you either delete the DLL from the bin folder before running the tests, or if you manually copy Microsoft.Extensions.DependencyInjection.Abstractions.dll (from NuGet package 6.0.0 which is still latest) to the bin folder, then code coverage is working again. Really strange... |
Got a sample working where i got the error. Hopefully its not just on my machine. For some reason it is the combination of App insights and EF. Then did the following command: dotnet test "--collect:XPlat Code Coverage" --configuration Release --logger trx --results-directory result |
Hey!
|
I can repro too, using @KlemensGenetec sample. Simply removing the AppInsight nuget package is enough for the tests to work again. |
I have the same issue, can someone suggest a solution for pipeline? |
You can use something similar to Then you need to make sure that That will work if you have msbuild installed. |
@KlemensGenetec thanks for suggestion, but I'm using linux builds and this command: |
I agree with @Krashlog about "Microsoft.ApplicationInsights.AspNetCore". If I remove it from reference than all start working. Also I see Microsoft.Extensions.DependencyInjection.dll after removing "Microsoft.ApplicationInsights.AspNetCore" |
Shall we go to "Microsoft.ApplicationInsights.AspNetCore" and create issue there? |
@KlemensGenetec thanks for the repro. I'm not 100% sure what exactly the problem is yet, but it is definitely related to the change @candritzky mentioned here:
Coverlet currently references both I compiled a new version of coverlet that at least solved this issue for the repro. I would be happy if someone could give it a try. 😄 |
Hey @daveMueller !
|
How fast can this be released? We have only 1 week to get this in or we need to downgrade Microsoft NuGets again. Thx |
Hello hope we can have the fix soon but I find it really strange that you have any dependency risk with the instrumented code and library . |
Merged so will get into the nightly builds now: |
Sorry, do you have any plans when it will be released? |
Ping @MarcoRossignoli |
By the end of the week I should be able to release a minor release |
Which is very good and helps us |
3.2.0 released |
@MarcoRossignoli Thanks, everythings works properly |
Hi,
I noticed that if I upgrade my EF Core libraries to latest (6.0.10), I get an error with coverlet:
I'm trying to upgrade Microsoft.EntityFrameworkCore from 6.0.9 to 6.0.10. My project is latest .NET 6.
Is this happening to anyone else? Is there a fix?
The text was updated successfully, but these errors were encountered: