I have a c# model with a DateTime
property LastActivityDate
, and I am trying to change it date to something else (some back date) while debugging from Quick Watch window (also tried immediate window). But when I do so, I got crash
Object reference not set to an instance of an object
It works if I do following:
processingDates.LastActivityDate = DateTime.Now
But doesn't work with following:
processingDates.LastActivityDate = new DateTime(2016,6,12)
Could not get the reason for this even after scratching my head for some hours.
Does anyone has a clue?
Note: The class is
public
, and the property is not readonly (alsopublic
). Just a simpleget;set;
property
Edit (adding code to remove confusion that processingDates
might be null
):
(I don't want to change code, so while debugging I am changing value just after instantiating)
var processingDates = new MyClassParameter()
{
StopRecurrenceProcessDate = DateTime.Now,
NextProcessingDate = DateTime.Now,
LastActivityDate = DateTime.Now
};
if (projectId <= 0) //I AM Changing value in quick watch here