'Object reference not set to an instancet - variable has value still error is coming [duplicate]
I am getting error like Object reference not set to an instance of an object.
But while debugging I see value is coming perfectly in variable, so any idea why still this error is coming.
please see below image and below code also.
var vipAppointmentType = await _codeTypeRepository.GetCodeSetsAsQueryable()
.FirstOrDefaultAsync(c => c.Id == entity.VIPTypeId);
var dto = ViewVipAppointmentTypeDto.Create(
entity.Id,
entity.Code,
entity.Description,
vipAppointmentType.Name,
entity.IsFreeMembership);
dto.VipType.Id = vipAppointmentType.Id;
dto.VipType.Name = vipAppointmentType.Name;
dto.VipType.AbbreviationCode = vipAppointmentType.AbbreviationCode;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
