Dashboard Jobs section throwing Object reference error

Hi there,

All of a sudden my Hangfire dashboard throws a “Object reference not set to an instance of an object.” error when trying to open the jobs area of the dashboard.

So i have 2 questions around this.

  1. How do i resolve the issue
  2. how to i delete job sitting in queue if i am not able to get into the dashboard? Is there a way to programatically force Hangfire to purge all jobs sitting in queue?

I would start by looking at the Windows Event log to find the stack trace where you are getting the null reference

Thanks for the reply. I’m not getting much direction from the event log or .net error. On the dashboard page the UI says there are 7 jobs queued and 2 failed. I can’t get much further than that. I’m working in a dev environment with Hangfire running on IISExpress as i debug my application in VS. You welcome to take a peak:

Exception information:
Exception type: NullReferenceException
Exception message: Object reference not set to an instance of an object.
at Hangfire.Dashboard.Pages.QueuesPage.Execute()
at Hangfire.Dashboard.RazorPage.TransformText(String body)
at Hangfire.Dashboard.RazorPage.ToString()
at Hangfire.Dashboard.RazorPageDispatcher.Dispatch(RequestDispatcherContext context)
at Hangfire.Dashboard.MiddlewareExtensions.<>c__DisplayClass6.<>c__DisplayClass8.b__4(IDictionary`2 env)
at Microsoft.Owin.Infrastructure.AppFuncTransition.Invoke(IOwinContext context)
at Microsoft.Owin.Mapping.MapMiddleware.d__0.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.d__5.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.d__2.MoveNext()
— End of stack trace from previous location where exception was thrown —
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar)
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar)
at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Object reference not set to an instance of an object. at Hangfire.Dashboard.Pages.QueuesPage.Execute() at Hangfire.Dashboard.RazorPage.TransformText(String body) at Hangfire.Dashboard.RazorPage.ToString() at Hangfire.Dashboard.RazorPageDispatcher.Dispatch(RequestDispatcherContext context) at Hangfire.Dashboard.MiddlewareExtensions.<>c__DisplayClass6.<>c__DisplayClass8.b__4(IDictionary`2 env) at Microsoft.Owin.Infrastructure.AppFuncTransition.Invoke(IOwinContext context) at Microsoft.Owin.Mapping.MapMiddleware.d__0.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.d__5.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.d__2.MoveNext() — End of stack trace from previous location where exception was thrown — at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar) at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar) at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
http://localhost:50593/hangfire/jobs/enqueued
/hangfire/jobs/enqueued
::1

False

xxxxxxxxx
9
xxxxxxxxx
False
at Hangfire.Dashboard.Pages.QueuesPage.Execute() at Hangfire.Dashboard.RazorPage.TransformText(String body) at Hangfire.Dashboard.RazorPage.ToString() at Hangfire.Dashboard.RazorPageDispatcher.Dispatch(RequestDispatcherContext context) at Hangfire.Dashboard.MiddlewareExtensions.<>c__DisplayClass6.<>c__DisplayClass8.b__4(IDictionary`2 env) at Microsoft.Owin.Infrastructure.AppFuncTransition.Invoke(IOwinContext context) at Microsoft.Owin.Mapping.MapMiddleware.d__0.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.d__5.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.d__2.MoveNext() — End of stack trace from previous location where exception was thrown — at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar) at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar) at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)