Base solution for your next web application
Open Closed

HealthCheck errors after upgrade to v13 #12575


User avatar
0
hra created

We have a deployment of ASP.net core + Angular, and have recently upgraded from v10 to v13. Our logs our now full of these errors (every time the "healthcheck" runs - which is every 10 seconds):

ERROR 2025-11-10 20:56:31,478 [null)] [null)] [1    ] ervice.HealthCheckCollectorHostedService - HealthCheck collector HostedService threw an error: Could not load file or assembly 'IdentityModel, Version=5.2.0.0, Culture=neutral, PublicKeyToken=e7877f4675df049f'. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'IdentityModel, Version=5.2.0.0, Culture=neutral, PublicKeyToken=e7877f4675df049f'. The system cannot find the file specified.
File name: 'IdentityModel, Version=5.2.0.0, Culture=neutral, PublicKeyToken=e7877f4675df049f'
   at HealthChecks.UI.Core.HostedService.HealthCheckReportCollector.GetHealthReportAsync(HealthCheckConfiguration configuration)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at HealthChecks.UI.Core.HostedService.HealthCheckReportCollector.GetHealthReportAsync(HealthCheckConfiguration configuration)
   at HealthChecks.UI.Core.HostedService.HealthCheckReportCollector.Collect(CancellationToken cancellationToken) in /home/runner/work/AspNetCore.Diagnostics.HealthChecks/AspNetCore.Diagnostics.HealthChecks/src/HealthChecks.UI/Core/HostedService/HealthCheckReportCollector.cs:line 72
   at HealthChecks.UI.Core.HostedService.HealthCheckCollectorHostedService.CollectAsync(CancellationToken cancellationToken) in /home/runner/work/AspNetCore.Diagnostics.HealthChecks/AspNetCore.Diagnostics.HealthChecks/src/HealthChecks.UI/Core/HostedService/HealthCheckReportCollectorHostedService.cs:line 84

None of the stack trace points to code in our project, it's all compiled dependencies coming from ANZ/boilerplate. Please advise how to fix.

Thank you.

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

5 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @hra

    Could you please share with us the version of the packages AspNetCore.HealthChecks.UI and AspNetCore.HealthChecks.UI.* installed in your current project?

    Also, is the IdentityModel package added as Top Level in your project? We need to ensure that the IdentityModel package is a version compatible with the HealthCheck packages. In the default Asp.Net Zero project, the IdentityModel package is added as a top-level package only in the ConsoleApiClient project. Other related projects are added as a Transitive package.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    hra created

    Hi,

    Here is a screenshot of our package manager

    IdentityModel is only referenced by the ConsoleApiClient, as you have stated.

    The package references of my Web.Core and Web.Host are the same as the ANZ default template with regards to all the HealthCheck and IdentityModel references.

    I see that IdentityModel was deprecated in March last year, but the latest ANZ codebase still imports it - and it references v7 which never went stable - so there's an issue there at least. https://www.nuget.org/packages/identitymodel/#readme-body-tab

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @hra

    This occurs because the HealthChecks UI packages included with ASP.NET ZERO v13 still expect IdentityModel 5.2.0.0, and the project only includes IdentityModel 7.x as a transitive dependency. A simple solution is to add IdentityModel 5.2.0 as a top-level package to projects that reference IdentityModel.

    <PackageReference Include="IdentityModel" Version="5.2.0" />
    

    Once this version is released, the HealthCheck collector will stop giving errors. Could you please let us know if the issue is resolved after applying this change?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    hra created

    Hi oguzhanagir,

    Thank you, this has resolved the error.

    I have 2 follow up questions:

    1. Can you confirm, this is a bug in the default template project file, (i.e, not introduced by us)? I have not changed any references related to this during our upgrade.

    2. I see that this library has been deprecated since February 2024. We are running ANZ v13.4.0, which was released in September 2024. I can only assume that ANZ is still depending on libraries that are pulling in this no longer supported IdentityModel library (in fact, superseded), how is Volosoft handling this? Ideally I would like to get rid of this out of date dependency in our current release - as we have just completed our ANZ upgrade, which took several months. This is important for our supply-chain auditing.

    Thank you

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @hra

    We've created an issue for this, and you can follow the developments here. We may modify the packages to make them compatible here soon, and we'll evaluate this situation. Thank you.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)