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

Job Details Page throws Exception #566

Closed
dazbradbury opened this issue May 11, 2016 · 9 comments
Closed

Job Details Page throws Exception #566

dazbradbury opened this issue May 11, 2016 · 9 comments

Comments

@dazbradbury
Copy link

Hi @odinserj -

In the latest beta release (1.6.0-beta2), clicking through to a job details page:

eg: /hangfire/jobs/details/2376579

Causes an exception to be thrown:

Object reference not set to an instance of an object.
at Hangfire.Dashboard.JobMethodCallRenderer.ArgumentRenderer.Render(Boolean isJson, String deserializedValue, String rawValue) at Hangfire.Dashboard.JobMethodCallRenderer.Render(Job job) at Hangfire.Dashboard.Pages.JobDetailsPage.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__DisplayClass1_1.<UseHangfireDashboard>b__1(IDictionary`2 env) at Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown ---

Not sure if this has been noticed yet, so thought I'd mention it!

Thanks again for your hard work and awesome code.

@odinserj
Copy link
Member

Thanks for reporting! Please post here the signature of a method that causes this exception.

@dazbradbury
Copy link
Author

Hi,

This is the full stacktrace. It happens when going to view job details for some, but not all, jobs:

Object reference not set to an instance of an object.
at Hangfire.Dashboard.JobMethodCallRenderer.ArgumentRenderer.Render(Boolean isJson, String deserializedValue, String rawValue) at Hangfire.Dashboard.JobMethodCallRenderer.Render(Job job) at Hangfire.Dashboard.Pages.JobDetailsPage.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__DisplayClass1_1.<UseHangfireDashboard>b__1(IDictionary`2 env) at Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.<RunApp>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.<DoFinalWork>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Owin.Host.SystemWeb.Infrastructure.ErrorState.Rethrow() 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)

I can pull in the project and debug directly (as with just the dll it's not giving me any further insight), if it's not clear from the above, or it's only affecting my app - I just guessed it was impacting everyone. Seems to happen when looking at failed jobs, but I suspect it's something to do with the job data.

This only started happening when I upgraded from version 1.5.3.

@odinserj
Copy link
Member

Looks one of the parameter types of your method causing this exception. Can you post the signature of the method here (e.g. void MyMethod(Type1 arg1, Type2 arg2))? However, it would be awesome, if you can help with debugging!

@dazbradbury
Copy link
Author

Thanks - I believe Hangfire handles this path, so the methods aren't
executed by my code, it's the Hangfire dashboard calling it. Perhaps I
submitted the issue to the wrong project?

Happy to take a closer look if it helps, and again, thanks for the awesome
work.
On 13 May 2016 18:18, "Sergey Odinokov" notifications@github.com wrote:

Looks one of the parameter types of your method causing this exception.
Can you post the signature of the method here (e.g. void MyMethod(Type1
arg1, Type2 arg2))? However, it would be awesome, if you can help with
debugging!


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#566 (comment)

@simonberrynoq
Copy link

Hi,

I get the same issue. I am creating a recurring job that takes two params:
Task ExecuteImplementation(IJobCancellationToken cancellationToken, TData jobData);

I am passing cancellationToken as JobCancellationToken.Null. The job runs OK and is passed a real JobCancellationToken but the param is stored as null in the database.

If I remove the first param, it works as expected and I don't see the exception when clicking on job details so it seems connected to passing IJobCancellationToken.

I also tried passing a real JobCancellationToken in but this also failed.

Thanks
Simon

@odinserj odinserj added this to the 1.6.0 milestone Jul 12, 2016
@odinserj
Copy link
Member

@simonberrynoq, thanks for the details! Fixed in build #2135.

odinserj added a commit that referenced this issue Jul 12, 2016
@dazbradbury
Copy link
Author

Apologies for the delay, but not sure if this fix is for the same bug.

Attaching the Hangfire source to a running instance of our web app, I can see the error is happening here:

image

What's being passed in at this point is a List of strings:

image

The type signature for this Paramater is List<string> bcc = null - ie. it's a default null List of Strings.

This seems to break the dashboard when viewing a job's details page.

I fixed it on my end by handling this situation the same way as if enumerable Arugument is null. So changing it to:

Line 120 in DashBoard\JobMethodCallRenderer.cs:

    if (enumerableArgument == null || argumentValue == null)
    {
         var argumentRenderer = ArgumentRenderer.GetRenderer(parameter.ParameterType);
          ...

Thanks!

@dazbradbury
Copy link
Author

@odinserj Let me know if you'd prefer me to open a new issue, and thanks again for the frequent updates!

@odinserj odinserj modified the milestones: 1.6.1, 1.6.0 Jul 22, 2016
@odinserj
Copy link
Member

@dazbradbury, thanks for reporting! This is the same bug, but another case.

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

No branches or pull requests

3 participants