Skip to content
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

coverlet.collector v3.1.0 causes fatal package downgrade of Microsoft.Extensions.DependencyInjection #1270

Closed
TonyTroeff opened this issue Dec 20, 2021 · 3 comments
Labels
bug Something isn't working Solved The issue is solved and can be closed

Comments

@TonyTroeff
Copy link

In some of my tests my team needs to start an instance of one of our services. This is a part of the code:

var hostBuilder = CreateHostBuilder(args);
var host = hostBuilder.Build();
await host.ExecuteStartupTasksAsync();

await host.RunAsync();

Unfortunatelly, after publishing the tests project the reference to Microsoft.EXtensions.DependencyInjection is downgraded to 2.2.0 and we receive the following exception upon tests execution:

Error Message:
   System.MissingMethodException : Method not found: 'Void Microsoft.Extensions.DependencyInjection.ServiceProviderOptions.set_ValidateOnBuild(Boolean)'.
  Stack Trace:
     at Microsoft.Extensions.Hosting.Host.<>c.<CreateDefaultBuilder>b__1_3(HostBuilderContext context, ServiceProviderOptions options)
   at Microsoft.Extensions.Hosting.HostingHostBuilderExtensions.<>c__DisplayClass3_0.<UseDefaultServiceProvider>b__0(HostBuilderContext context)
   at Microsoft.Extensions.Hosting.Internal.ServiceFactoryAdapter`1.CreateBuilder(IServiceCollection services)
   at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()

This property ValidateOnBuild is added after Microsoft.Extensions.DependencyInjection version 3.0.0 so it really could not be found.

I would be very interested to understand why coverlet should reference this package and how could we potentially fix our issue without removing coverlet as this is something we would not like to do.

@petli
Copy link
Collaborator

petli commented Dec 20, 2021

This is mostly a guess, but it may be similar to the issue with Newtonsoft.Json during publish that was fixed by #1243, so maybe that PR will also fix this case. It's not released yet, but should be in the nightly build if you want to give it a try:
https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/ConsumeNightlyBuild.md

@MarcoRossignoli MarcoRossignoli added bug Something isn't working Solved The issue is solved and can be closed labels Dec 20, 2021
@MarcoRossignoli
Copy link
Collaborator

@petli is right, can you try the nightly build and let us know if it's solved?
So we can also do a release asap.

@MarcoRossignoli
Copy link
Collaborator

Solved into shipped 3.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Solved The issue is solved and can be closed
Projects
None yet
Development

No branches or pull requests

3 participants