This bug prevents running all recurring jobs, and also prevents me to open "Recurrent" page. I was able to cure it by re-creating of the database.
This bug is reproduced on the latest version of this package and the latest version of Hangfire.Core.
An unhandled exception has occurred while executing the request.
System.ArgumentException: An item with the same key has already been added. Key: NextExecution
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at System.Linq.Enumerable.SpanToDictionary[TSource,TKey,TElement](ReadOnlySpan`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
at Hangfire.PostgreSql.PostgreSqlConnection.<>c__DisplayClass18_0.<GetAllEntriesFromHash>b__0(DbConnection connection)
at Hangfire.PostgreSql.PostgreSqlStorage.UseConnection[T](DbConnection dedicatedConnection, Func`2 func)
at Hangfire.PostgreSql.PostgreSqlConnection.GetAllEntriesFromHash(String key)
at Hangfire.Storage.StorageConnectionExtensions.GetRecurringJobDtos(IStorageConnection connection, IEnumerable`1 ids) in C:\\projects\\hangfire-525\\src\\Hangfire.Core\\Storage\\StorageConnectionExtensions.cs:line 94
at Hangfire.Storage.StorageConnectionExtensions.GetRecurringJobs(JobStorageConnection connection, Int32 startingFrom, Int32 endingAt) in C:\\projects\\hangfire-525\\src\\Hangfire.Core\\Storage\\StorageConnectionExtensions.cs:line 72
at Hangfire.Dashboard.Pages.RecurringJobsPage.Execute() in C:\\projects\\hangfire-525\\src\\Hangfire.Core\\Dashboard\\Pages\\RecurringJobsPage.cshtml:line 28
at Hangfire.Dashboard.RazorPage.TransformText(String body) in C:\\projects\\hangfire-525\\src\\Hangfire.Core\\Dashboard\\RazorPage.cs:line 179
at Hangfire.Dashboard.RazorPage.ToString() in C:\\projects\\hangfire-525\\src\\Hangfire.Core\\Dashboard\\RazorPage.cs:line 103
at Hangfire.Dashboard.RazorPageDispatcher.Dispatch(DashboardContext context) in C:\\projects\\hangfire-525\\src\\Hangfire.Core\\Dashboard\\RazorPageDispatcher.cs:line 38
at Hangfire.Dashboard.AspNetCoreDashboardMiddleware.Invoke(HttpContext httpContext) in C:\\projects\\hangfire-525\\src\\Hangfire.AspNetCore\\Dashboard\\AspNetCoreDashboardMiddleware.cs:line 99
at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.InvokeCore(HttpContext context, PathString matchedPath, PathString remainingPath)
...
Stack trace when a scheduled job is about to be run:
Execution RecurringJobScheduler is in the Failed state now due to an exception, execution will be retried in no more than 00:00:25
System.ArgumentException: An item with the same key has already been added. Key: NextExecution
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at System.Linq.Enumerable.SpanToDictionary[TSource,TKey,TElement](ReadOnlySpan`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
at Hangfire.PostgreSql.PostgreSqlConnection.<>c__DisplayClass18_0.<GetAllEntriesFromHash>b__0(DbConnection connection)
at Hangfire.PostgreSql.PostgreSqlStorage.UseConnection[T](DbConnection dedicatedConnection, Func`2 func)
at Hangfire.PostgreSql.PostgreSqlConnection.GetAllEntriesFromHash(String key)
at Hangfire.RecurringJobExtensions.GetRecurringJob(IStorageConnection connection, String recurringJobId) in C:\\projects\\hangfire-525\\src\\Hangfire.Core\\RecurringJobExtensions.cs:line 49
at Hangfire.Server.RecurringJobScheduler.TryEnqueueBackgroundJob(BackgroundProcessContext context, IStorageConnection connection, String recurringJobId, DateTime now) in C:\\projects\\hangfire-525\\src\\Hangfire.Core\\Server\\RecurringJobScheduler.cs:line 288
at Hangfire.Server.RecurringJobScheduler.<>c__DisplayClass27_0.<EnqueueNextRecurringJobs>b__0(IStorageConnection connection) in C:\\projects\\hangfire-525\\src\\Hangfire.Core\\Server\\RecurringJobScheduler.cs:line 248
at Hangfire.Server.RecurringJobScheduler.UseConnectionDistributedLock[T](JobStorage storage, Func`2 action) in C:\\projects\\hangfire-525\\src\\Hangfire.Core\\Server\\RecurringJobScheduler.cs:line 425
at Hangfire.Server.RecurringJobScheduler.EnqueueNextRecurringJobs(BackgroundProcessContext context) in C:\\projects\\hangfire-525\\src\\Hangfire.Core\\Server\\RecurringJobScheduler.cs:line 203
at Hangfire.Server.RecurringJobScheduler.Execute(BackgroundProcessContext context) in C:\\projects\\hangfire-525\\src\\Hangfire.Core\\Server\\RecurringJobScheduler.cs:line 176
at Hangfire.Server.BackgroundProcessDispatcherBuilder.ExecuteProcess(Guid executionId, Object state) in C:\\projects\\hangfire-525\\src\\Hangfire.Core\\Server\\BackgroundProcessDispatcherBuilder.cs:line 82
at Hangfire.Processing.BackgroundExecution.Run(Action`2 callback, Object state) in C:\\projects\\hangfire-525\\src\\Hangfire.Core\\Processing\\BackgroundExecution.cs:line 118
I've saved the "broken database" and can provide it for the investigation.
This bug prevents running all recurring jobs, and also prevents me to open "Recurrent" page. I was able to cure it by re-creating of the database.
This bug is reproduced on the latest version of this package and the latest version of Hangfire.Core.
Stack trace when a scheduled job is about to be run:
I've saved the "broken database" and can provide it for the investigation.