AspNetCore.Diagnostics.HealthChecks
AspNetCore.Diagnostics.HealthChecks copied to clipboard
After update package 7.0.0 on asp.net core 6.0 Im geting error
After update package 7.0.0 on asp.net core 6.0 Im geting error
Hi,
I've experienced it as well.
Try installing Microsoft.Bcl.AsyncInterfaces
in version 7.0.0
.
See https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/pull/1720 . This PR explains the problem. @phivanloi What packages exactly do you use? We can add reference to Microsoft.Bcl.AsyncInterfaces as we already did in #1720.
Thanks cieciurm And sungam3r. I'm add line code
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
to fix this error.
Hi, I also had the same issue and also fixed it by adding Microsoft.Bcl.AsyncInterfaces
to all projects using healthchecks.
However, this is more of a workaround than a fix, isn't it? Shouldn't AspNetCore.Diagnostics.HealthChecks
bring it as a dependency if it needs it? Otherwise, the Readme should specify clearly that this dependency must be added alongside AspNetCore.Diagnostics.HealthChecks
.
However, this is more of a workaround than a fix, isn't it?
It's hard to tell.
Shouldn't AspNetCore.Diagnostics.HealthChecks bring it as a dependency if it needs it?
Please read https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/pull/1692#issuecomment-1448434526 . It looks like an issue on MS side. HealthChecks' packages are just intermediate victim. I'm open to suggestions and best practices.
@corentinaltepe Please look into deps file in your output folder and search exact package that depends on Microsoft.Bcl.AsyncInterfaces.
Hi @sungam3r.
Is this what you were looking for?
Also ran into this on our .NET 6 app. Caused by the dependency on Microsoft.Extensions.Diagnostics.HealthChecks v7, which brings in other .NET 7 deps. We've avoided using .NET 7 packages in our .NET 6 apps due to that not feeling right (does every .NET 7 package guarantee backwards compatibility with ASP.NET Core 6? Seems unlikely). Unless you add a TFM for .NET 6 that targets Microsoft.Extensions.Diagnostics.HealthChecks v6, looks like we'll be waiting to upgrade from v6 until we go to .NET 8.
This happens even in .NET 7 with AspNetCore.HealthChecks.AzureStorage.
To be honest, I'm not sure if it's related to the AspNetCore.HealthChecks
packages.
I've experienced it in a project which didn't use Health Checks.
The setup was:
- Web project target .net 6
- Some other project targeting .net standard 2.0 with dependency to
Azure.Storage.Blobs
- Web projects is referencing the other project
On running the web project the described errors occurs.
Hmm, I now removed the Microsoft.Bcl.AsyncInterfaces
dependency and it works fine. The only thing that changed, as far as I know, is that I installed the most recent .NET 7 SDK (7.0.400). Perhaps that fixed it?
Hm, scratch that. Still fails on CI.
When installing the version 7.0.0 packages of AspNetCore.HealthChecks.AzureServiceBus or AspNetCore.HealthChecks.AzureStorage to .net 7 projects it seems that the DLLs target .netstandard 2.0. The version 6 packages targeted .NETCoreApp, Version=v6.0 when installing to .net 6 project. Seems like a version mismatch in the libraries. .NET 7 shouldn't need to reference the Microsoft.Bcl.AsyncInterfaces library.
EDIT: OK so this is a targeting issue. You'll want to multi target these libraries and add .net 7 target for version 7 packages.
We had the same problem in ASP.NET Core application in .NET 6 project, when upgrading the AspNetCore.HealthChecks.Oracle nuget package from version 6.x to version 7.x
Currently, the AspNetCore.HealthChecks.Oracle package version 7.x now has a dependency on Microsoft.Extensions.Diagnostics.HealthChecks (>= 7.0.9)
Meanwhile, the AspNetCore.HealthChecks.Oracle package in version 6.x had this dependency: Microsoft.Extensions.Diagnostics.HealthChecks (>= 6.0.3)
In fact, all nuget packages of Microsoft.Extension.* version 7.x run in .NET 6 just fine, without any problems (they all have a target on net6.0). So maybe it was not worth changing the minimum version in the dependency to Microsoft.Extensions.Diagnostics.HealthChecks.
Please consider changing the dependency from Microsoft.Extensions.Diagnostics.HealthChecks (>= 7.0.9) to Microsoft.Extensions.Diagnostics.HealthChecks (>= 6.0.3), or having separate targets for net6.0 and net7.0.
Please consider changing the dependency from Microsoft.Extensions.Diagnostics.HealthChecks (>= 7.0.9) to Microsoft.Extensions.Diagnostics.HealthChecks (>= 6.0.3), or having separate targets for net6.0 and net7.0.
Well... Of course it's possible but I think it goes against current targeting design when v X.* versions of packages are targeted at v X.* version of NET.
ping @unaizorrilla @adamsitnik
Well... Of course it's possible but I think it goes against current targeting design when v X.* versions of packages are targeted at v X.* version of NET.
If you are using .NET X you should be using X.* version of our packages.
Guys, what do you think about https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/pull/1980#issuecomment-1924352450 ?