MattNorman
Well-known member
- Joined
- May 22, 2021
- Messages
- 98
- Programming Experience
- 1-3
I am getting an object null reference when setting a property on a newly created object:
The exception is thrown on the second line and exception message is as follows:
I also added in to test lines that don't throw any exceptions as follows:
The property for the 'ReportAgentCallSummaryFilterModel' class is as follows:
C#:
ReportAgentCallSummaryFilterModel filtersReportPeriod = new ReportAgentCallSummaryFilterModel();
filtersReportPeriod.ReportInterval = FilterData.ReportInterval;
The exception is thrown on the second line and exception message is as follows:
I am a little confused as inspecting both 'filtersReportPeriod' and 'FilterData' shows that neither are null.System.NullReferenceException: Object reference not set to an instance of an object.
at ApexCCM.Models.ReportAgentCallSummaryFilterModel.set_ReportInterval(ReportIntervals value) in C:\Users\normanm\source\repos\New\ApexCCM\Models\ReportAgentCallSummaryFilterModel.cs:line 65
at ApexCCM.ViewModels.ReportOperationalInsightsViewModel.GetReportDataAgent() in C:\Users\normanm\source\repos\New\ApexCCM\ViewModels\ReportOperationalInsightsViewModel.cs:line 436
I also added in to test lines that don't throw any exceptions as follows:
C#:
ReportAgentCallSummaryFilterModel filtersReportPeriod = new ReportAgentCallSummaryFilterModel();
ReportIntervals test = FilterData.ReportInterval;
ReportIntervals test2 = filtersReportPeriod.ReportInterval;
filtersReportPeriod.ReportInterval = FilterData.ReportInterval;
The property for the 'ReportAgentCallSummaryFilterModel' class is as follows:
C#:
private ReportIntervals reportInterval = ReportIntervals.Intraday;
public ReportIntervals ReportInterval
{
get
{
return reportInterval;
}
set
{
reportInterval = value;
ReportTimesRowHeight = ReportInterval == ReportIntervals.Intraday ? 35 : 0;
AppDataStore.ReportOperationalInsightsFilterViewModelRef.GetDates();
}
}