Hi there, information is below. This is a .netcore 2 project that hosts hangfire, and this is the only place we’ve had this problem the desktop .net hangfire server we have does not exhibit this issue. My gut tells me this is something related to dotnetcore and hangfire.
CronJob.AddOrUpdate(typeof(IRecurringJob));
Job:
public interface IRecurringJob : IHangfireJob
{
[DisplayName("Checks for new documents")]
[Description("Checks for new documents")]
[AutomaticRetry(Attempts = 3)]
[RecurringJob("* * * * *", Queue = "docs", RecurringJobId = "Checks for new documents", TimeZone = "UTC")]
void CheckForDocuments(PerformContext context);
}
Dependencies for the dotnet core hangfire server:
Full stack trace:
Newtonsoft.Json.JsonSerializationException
Error converting value “Hangfire.Server.PerformContext, Hangfire.Core, Version=1.6.19.0, Culture=neutral, PublicKeyToken=null” to type ‘System.Type’. Path ‘[0]’, line 1, position 104.
Newtonsoft.Json.JsonSerializationException: Error converting value "Hangfire.Server.PerformContext, Hangfire.Core, Version=1.6.19.0, Culture=neutral, PublicKeyToken=null" to type 'System.Type'. Path '[0]', line 1, position 104. ---> System.ArgumentException: Could not cast or convert from System.String to System.Type.
at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
--- End of inner exception stack trace ---
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Hangfire.Common.JobHelper.FromJson[T](String value)
at Hangfire.Storage.InvocationData.Deserialize()