Hi,
Can you please have a look and see if you can help with my following code failing?
` private async Task ScheduleBroadcastMessageJob(CreateOrUpdateBroadcastMessageInput input, string broadcastMessageId) {
var currentTicks = DateTime.Now.Ticks;
var scheduleTicks = input.ScheduleDateTime.Value.Ticks;
TimeSpan scheduleTime;
if (input.SendType == BroadcastSendType.Schedule)
scheduleTime = TimeSpan.FromTicks(scheduleTicks - currentTicks);
else
scheduleTime = new TimeSpan(0, 0, 30);
await BackgroundJobManager.EnqueueAsync<BroadcastMessageJob, BroadcastMessageJobArgs>(new BroadcastMessageJobArgs
{
MessageInput = input,
BroadcastMessageId = broadcastMessageId
}, BackgroundJobPriority.Normal, scheduleTime);
}`
Error Log
Failed Can not change the state to 'Enqueued': target method was not found.
System.TypeLoadException Could not load type 'HB.IQ.Main.Broadcast.BroadcastMessageJob' from assembly 'HB.IQ.Application, Version=7.2.0.0, Culture=neutral, PublicKeyToken=null'.
System.TypeLoadException: Could not load type 'HB.IQ.Main.Broadcast.BroadcastMessageJob' from assembly 'HB.IQ.Application, Version=7.2.0.0, Culture=neutral, PublicKeyToken=null'.
at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive)
at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at System.TypeNameParser.ResolveType(Assembly assembly, String[] names, Func4 typeResolver, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark) at System.TypeNameParser.ConstructType(Func2 assemblyResolver, Func4 typeResolver, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark) at System.TypeNameParser.GetType(String typeName, Func2 assemblyResolver, Func4 typeResolver, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark) at System.Type.GetType(String typeName, Func2 assemblyResolver, Func`4 typeResolver, Boolean throwOnError)
at Hangfire.Common.TypeHelper.DefaultTypeResolver(String typeName)
at Hangfire.Storage.InvocationData.DeserializeJob()
4 Answer(s)
-
0
hi
This looks like a problem with hangfire, can you provide steps to reproduce the problem.
https://discuss.hangfire.io/t/can-not-change-the-state-to-enqueue-target-method-was-not-found/5752/4
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Thanks.
One point i missed was that it works fine if i don't provide this "BackgroundJobPriority.Normal, scheduleTime)"
Its actually quite simple re-produce.
BackgroundJobManager.EnqueueAsync's Job which works would stop working if the delay timestamp is provided.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
What version of ABP are you using? What version of the hangfire related package are you using?
I use ABP's free startup template, which is ABP 5.1.0, and HangFire 1.7.7 does not reproduce the problem you mentioned.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Thanks for your reply. Got it fixed. There were two HangFire Services was running for two difference branches of the projects. As soon as we stopped all services but one everything start working.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)