System.InvalidOperationException: The type `OSPC.Shared.Core.Commands.ICommandDispatcher` does not contain a method with signature `Dispatch(String, String)`


#1

In development when I stop my application I can see in the database that apparently the hangfire jobs are continue to be running. I see new records appearing in the table HangFire.State.
Would it be possible that some code of Hangfire is still kept in memory and processing some jobs?
I can see in SQL server that the jobs are failing, which I find logic because the application is not running anymore.
But when I restart the application in development the jobs continue to failing

Failed
Can not change the state to ‘Enqueued’: target method was not found.

System.InvalidOperationException
The type OSPC.Shared.Core.Commands.ICommandDispatcher does not contain a method with signature Dispatch(String, String)

System.InvalidOperationException: The type OSPC.Shared.Core.Commands.ICommandDispatcher does not contain a method with signature Dispatch(String, String)
at Hangfire.Storage.InvocationData.Deserialize()

When I click on requeue then the job get processed again.

Is this a bug?


#2

I figured out this problem exists only for jobs created with BackgroundJob.Schedule.
For jobs created with BackgroundJob.Enqueue I don’t have this problem with the help of DynamicQueueAttribute discussed in this forum.


So it seems that Enqueued jobs are obeying to DynamicQueueAttribute but Scheduled jobs not.
Any reason why?