0

Please I have a job using Hangfire to trigger. It has been working fine until now and the error i am getting at the Hangfire.State in the SQL management studio is below.

{"FailedAt":"1611337036640","ExceptionType":"System.ArgumentNullException","ExceptionMessage":"String reference not set to an instance of a String.\r\nParameter name: s","ExceptionDetails":"System.ArgumentNullException: String reference not set to an instance of a String.\r\nParameter name: s\r\n at System.DateTimeParse.ParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style)\r\n at System.DateTime.ParseExact(String s, String format, IFormatProvider provider)\r\n at CreditFacility_Web.ScheduledJobs.RepaymentSchedule.AutoRepay() in C:\Users\ABIKE\Documents\Visual Studio 2019\Projects\CreditFacility_Web\ScheduledJobs\RepaymentSchedule.cs:line 42"}

That line 42 contains the code below:

                if (DateTime.ParseExact(item.first_Repayment_Date, "d", null).Date == WATTime.Date)
                 {
                    // Do this
                 }

Please Note that item.first_Repayment_Date is a string retrieved from the database and is in the format "22/01/2021"

I have used debugger to check the value of If and it is true but still the job will not run

uthumvc
  • 157
  • 8
  • check this: DateTime.ParseExact(item.first_Repayment_Date, "d", null). Does it return non null value? , – godot Jan 22 '21 at 18:02
  • 1
    Looks like `item.first_Repayment_Date` is null. If that's allowed you need to do a null check before attempting to parse, or you need to figure out why it's null and fix that. – juharr Jan 22 '21 at 18:10

0 Answers0