.NET Core - Exception when starting up

aspnetcore
Tags: #<Tag:0x00007f8b9a674c10>

#1

I am getting two System.ArgumentNullException: ‘Value cannot be null.
Parameter name: key’ exceptions when starting up a ASP.NET core 2.2 application with Hangfire 1.7.8. The call on which the exception is thrown in both cases is
Hangfire.SqlServer.dll!Hangfire.SqlServer.SqlServerConnection.GetFirstByLowestScoreFromSet(string key, double fromScore, double toScore, int count)

One exception seems to be after calls to DelayedJobScheduler and the other exception is after calls to RecurringJobScheduler

If I skip past the exceptions and continue debugging in my local environment then I am able to bypass these exceptions. I am worried about what will happen in production though. I have a simple hangfire test project with one solution and I get no errors. The project getting errors is the ‘real world’ solution.
Any comments would help. Thank you


#2

Having same issue… any solution yet?


#3

Unfortunately I don’t have an answer to why this issue exists. This issue does not cause problems when run in production - only when running locally. I can say that when updating my entire solution to .NET core 3.1 the issue goes away altogether. To make things more confusing I do not experience this issue on another machine (still with the .NET core 2.2 solution)


#4

Was there ever any solution to this? I’m getting the same issue with hangfire 1.7.13 in a MVC 5 (5.2.7) .NET 4.8 project.


#5

Safely ignore this exception as it’s handled by Hangfire itself. It is now used to determine whether some additional command set is available to use it by delayed and recurring job schedulers. I will add a TODO to modify this implementation in future to not to confuse anyone, but this logic can’t be changed in version 1.X without introducing breaking changes.