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

Problem with Health Check UI in .Net 6 #890

Closed
mehdihadeli opened this issue Dec 31, 2021 · 6 comments
Closed

Problem with Health Check UI in .Net 6 #890

mehdihadeli opened this issue Dec 31, 2021 · 6 comments

Comments

@mehdihadeli
Copy link

Hi,
I upgrade my application to .net 6 after upgrade, health UI doesn't work. I got below exception:

[21:22:25 INF] Initializing UI Database
[21:22:26 FTL] Host terminated unexpectedly
System.MissingMethodException: Method not found: 'Void Microsoft.EntityFrameworkCore.MutablePropertyExtensions.SetValueComparer(Microsoft.EntityFrameworkCore.Metadata.IMutableProperty, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer)'.
   at HealthChecks.UI.Core.Data.Configuration.HealthCheckExecutionEntryMap.Configure(EntityTypeBuilder`1 builder)
   at Microsoft.EntityFrameworkCore.ModelBuilder.ApplyConfiguration[TEntity](IEntityTypeConfiguration`1 configuration)
   at HealthChecks.UI.Core.Data.HealthChecksDb.OnModelCreating(ModelBuilder modelBuilder)
public static IApplicationBuilder UseCustomHealthCheck(this IApplicationBuilder app)
{
    app.UseHealthChecks("/healthz", new HealthCheckOptions
    {
        Predicate = _ => true,
        ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse,
        ResultStatusCodes =
        {
            [HealthStatus.Healthy] = StatusCodes.Status200OK,
            [HealthStatus.Degraded] = StatusCodes.Status500InternalServerError,
            [HealthStatus.Unhealthy] = StatusCodes.Status503ServiceUnavailable,
        },
    }).UseHealthChecksUI(setup =>
    {
        setup.ApiPath = "/healthcheck";
        setup.UIPath = "/healthcheck-ui";
    });

    return app;
}
public static IServiceCollection AddCustomHealthCheck(this IServiceCollection services,
        Action<IHealthChecksBuilder> configurator = null)
    {
        var healCheckBuilder = services.AddHealthChecks();
        configurator?.Invoke(healCheckBuilder);

        //// health check ui has problem with .net 6
        // services.AddHealthChecksUI(setup =>
        // {
        //     setup.SetEvaluationTimeInSeconds(60); //time in seconds between check
        //     setup.AddHealthCheckEndpoint("Basic Health Check", "/healthz");
        // }).AddInMemoryStorage();

        return services;
    }
@carlosrecuero
Copy link
Collaborator

Hi @mehdihadeli , I couldn't reproduce it.
Could you please check the sample on the repo: https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/tree/master/samples/HealthChecks.UI.Sample with the following packages (the latest), and verify if it also works for you?:

@mehdihadeli
Copy link
Author

Hi @carlosrecuero,
Yes, I will check it.
Also this is the source of my sample project and my startup.
https://github.com/mehdihadeli/partners-management

@carlosrecuero
Copy link
Collaborator

Hi @mehdihadeli , could you check it?

@mehdihadeli
Copy link
Author

@carlosrecuero With the new version of your library, it works.
Thanks

@carlosrecuero
Copy link
Collaborator

Thank you for your answer @mehdihadeli . I close the issue.

@mehdihadeli
Copy link
Author

Thank you for your answer @mehdihadeli . I close the issue.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants