Closed CesarStatik closed 4 years ago
Hi,
Please try again with version 0.2.4 and let me know the result.
It worked for that page but now if I click on the job details I get the following error, not sure if I should open a new issue, it looks similar but it appears to be present in a different part of code.
{
"error": {
"code": "ExceptionErrorCode",
"message": "The given key 'Queue' was not present in the dictionary.",
"target": "System.Collections.Generic.KeyNotFoundException",
"details": [
{
"code": "ExceptionStacktraceErrorCode",
"message": " at System.Collections.Generic.Dictionary2.get_Item(TKey key)\r\n at Hangfire.Dashboard.JobHistoryRenderer.EnqueuedRenderer(HtmlHelper helper, IDictionary
2 stateData)\r\n at Hangfire.Dashboard.Pages.JobDetailsPage.Execute()\r\n at Hangfire.Dashboard.RazorPage.TransformText(String body)\r\n at Hangfire.Dashboard.RazorPageDispatcher.Dispatch(DashboardContext context)\r\n at Hangfire.Dashboard.AspNetCoreDashboardMiddleware.Invoke(HttpContext httpContext)\r\n at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)\r\n at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)\r\n at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)\r\n at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIIndexMiddleware.Invoke(HttpContext httpContext)\r\n at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext)\r\n at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)\r\n at Enstoa.Application.Core.AspNetCore.Errors.ErrorHandlerMiddleware.Invoke(HttpContext context, ILogger`1 logger, IHostingEnvironment env)",
"details": []
}
]
}
}
OS? Version of Hangfire.Storage.SQLite?
OS? Version of Hangfire.Storage.SQLite?
OS: Windows 10 Pro 1909 Version of Hangfire.Storage.SQLite: 0.2.4
You could delete the Hangfire.db file that is created by default and try again.
I find the error strange.
I deleted the DB and ran the solution again and ran the job, it was executed successfully and I can see the Job in the page "/hangfire/jobs/succeeded" but as soon as I click on the job Id "/hangfire/jobs/details/1" this error occurs
{
"error": {
"code": "ExceptionErrorCode",
"message": "The given key 'Queue' was not present in the dictionary.",
"target": "System.Collections.Generic.KeyNotFoundException",
"details": [
{
"code": "ExceptionStacktraceErrorCode",
"message": " at System.Collections.Generic.Dictionary2.get_Item(TKey key)\r\n at Hangfire.Dashboard.JobHistoryRenderer.EnqueuedRenderer(HtmlHelper helper, IDictionary
2 stateData)\r\n at Hangfire.Dashboard.Pages.JobDetailsPage.Execute()\r\n at Hangfire.Dashboard.RazorPage.TransformText(String body)\r\n at Hangfire.Dashboard.RazorPageDispatcher.Dispatch(DashboardContext context)\r\n at Hangfire.Dashboard.AspNetCoreDashboardMiddleware.Invoke(HttpContext httpContext)\r\n at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)\r\n at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)\r\n at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)\r\n at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIIndexMiddleware.Invoke(HttpContext httpContext)\r\n at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext)\r\n at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)\r\n at Enstoa.Application.Core.AspNetCore.Errors.ErrorHandlerMiddleware.Invoke(HttpContext context, ILogger`1 logger, IHostingEnvironment env)",
"details": []
}
]
}
}
Could you share the code?
Let me create a new solution and see if I can replicate there and then I can share
I think the issue is rather on the "Hangfire.Dashboard.JobHistoryRenderer.EnqueuedRenderer" class, I just looked at the code "https://github.com/HangfireIO/Hangfire/blob/master/src/Hangfire.Core/Dashboard/JobHistoryRenderer.cs" and in the line 232 the are accessing the dictionary without checking if the key exist. I think this issue can be closed here.
Hi Felix,
I noticed that the issue still exist for the functions "ScheduledJobs", "ProcessingJobs" and "FailedJobs" on the "SQLiteMonitoringApi"class, It seems that you missed adding validations on "ExceptionDetails", "ExceptionMessage" and "ExceptionType" in the "FailedJobs" function, "StartedAt" in the "ProcessingJobs" function and "ScheduledAt" in the "ScheduledJobs" function.
Can you please include this validations?
I am getting this error while looking at the dashboad for the jobs that have been completed.
In the code I am doing something simple:
BackgroundJob.Enqueue(() => System.Console.WriteLine($"Hello world"));
{ "error": { "code": "ExceptionErrorCode", "message": "The given key 'SucceededAt' was not present in the dictionary.", "target": "System.Collections.Generic.KeyNotFoundException", "details": [ { "code": "ExceptionStacktraceErrorCode", "message": " at System.Collections.Generic.Dictionaryb__0(HangfireDbContext connection)\r\n at Hangfire.Dashboard.Pages.SucceededJobs.Execute()\r\n at Hangfire.Dashboard.RazorPage.TransformText(String body)\r\n at Hangfire.Dashboard.RazorPageDispatcher.Dispatch(DashboardContext context)\r\n at Hangfire.Dashboard.AspNetCoreDashboardMiddleware.Invoke(HttpContext httpContext)\r\n at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)\r\n at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)\r\n at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)\r\n at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIIndexMiddleware.Invoke(HttpContext httpContext)\r\n at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext)\r\n at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)\r\n at Enstoa.Application.Core.AspNetCore.Errors.ErrorHandlerMiddleware.Invoke(HttpContext context, ILogger`1 logger, IHostingEnvironment env)",
"details": []
}
]
}
}
2.get_Item(TKey key)\r\n at Hangfire.Storage.SQLite.SQLiteMonitoringApi.<>c.<SucceededJobs>b__33_1(JobDetailedDto sqlJob, Job job, Dictionary
2 stateData)\r\n at Hangfire.Storage.SQLite.SQLiteMonitoringApi.DeserializeJobs[TDto](ICollection1 jobs, Func
4 selector)\r\n at Hangfire.Storage.SQLite.SQLiteMonitoringApi.<>c__DisplayClass33_0.