I'm experiencing a TypeLoadException with a recurring job in Hangfire. The job works fine when triggered manually, but after some time, it fails in the recurring jobs tab with a type loading error.
System.InvalidOperationException: Recurring job can't be scheduled, see inner exception for details.
---> Hangfire.Common.JobLoadException: Could not load the job. See inner exception for the details.
---> System.TypeLoadException: Could not load type 'xMessagingAPI.Hangfire.Abstract.Jobs.ICalculateTotalSpendingsJob' from assembly 'xMessagingAPI.Hangfire, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
at System.Reflection.RuntimeAssembly.<GetType>g____PInvoke|26_0(QCallAssembly assembly, UInt16* name, Int32 throwOnError, Int32 ignoreCase, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive, ObjectHandleOnStack assemblyLoadContext)
Job Registration
services.AddScoped<ICalculateTotalSpendingsJob, CalculateTotalSpendingsJob>();
RecurringJob.AddOrUpdate<ICalculateTotalSpendingsJob>("calculate-total-spendings", x => x.RunAsync(), Cron.Minutely );
I'm experiencing a TypeLoadException with a recurring job in Hangfire. The job works fine when triggered manually, but after some time, it fails in the recurring jobs tab with a type loading error.
Job Registration
Hangfire Registration
Interface Definition
Implementation
Expected Behavior:
Actual Behavior:
Things I've Already Tried:
Environment