-4

I am trying to compare current date with a calculated date from offset as shown below. The line throws an exception, enters catch block but exception is null. I cannot find what is the exception because of it

DateTime.UtcNow.Date.CompareTo(new UtcDateTime(startDate.AddDays(activity.DueInDaysOffset.GetValueOrDefault()))) > 0

startDate is date from DB

activity.DueInDaysOffset is an integer - positive/negative.

UtcDateTime is a class from 'Microsoft.CommonDataService' used for conversion.

What could be the issue?

Ravi Sankar Rao
  • 972
  • 9
  • 24

1 Answers1

-2

Without knowing the rest of your code, I would guess that either startDate or activity is null. Verify that both variables have values.

BMI24
  • 101
  • 1
  • 6