In which line I am getting "Nullable object must have a value.?
05:17 26 Nov 2025

I have this code.

var res = new GetItemSerialForViewDto()

                {

                    ItemSerial = new ItemSerialDto

                    {

                        Index = index,

                        SerialValue = string.IsNullOrEmpty(o.SerialValue) ? "" : o.SerialValue,

                        WarrantyStartDate = o.WarrantyStartDate,

                        WarrantyEndDate = o.WarrantyEndDate,

                        Notes = string.IsNullOrEmpty(o.Notes) ? "" : o.Notes,

                        Id = o.Id,

                        VendorName = string.IsNullOrEmpty(o.VendorName) ? "" : o.VendorName,

                        ItemPartNumber = string.IsNullOrEmpty(o.ItemPartNumber) ? "" : o.ItemPartNumber,

                        ItemRfidTag = string.IsNullOrEmpty(o.RfidTag) ? "" : o.RfidTag,

                        DigitalIdentity = o.DigitalIdentity,

                        TagType = string.IsNullOrEmpty(o.TagType) ? "" : o.TagType,

                        Description = string.IsNullOrEmpty(o.Description) ? "" : o.Description,

                        Owner = string.IsNullOrEmpty(o.Owner) ? "" : o.Owner,

                        ReceivingDate = o.ReceivingDate,

                        //Status = o.Status,

                        //StatusName = statusLookup.Where(s =\> s.Id == (int)o.Status)?.FirstOrDefault()?.DisplayName,

                        // StatusName = statusLookup?.FirstOrDefault(s =\> s.Id == (int)(o.Status ?? 0))?.DisplayName,

                        OriginalCost = o.OriginalCost,

                        InServiceDate = o.InServiceDate,

                        Department = string.IsNullOrEmpty(o.Department) ? "" : o.Department,

                        EntityName = string.IsNullOrEmpty(o.EntityName) ? "" : o.EntityName,

                        locationClassificationName = string.IsNullOrEmpty(o.locationClassificationName) ? "" : o.locationClassificationName,

                        DepreciationMethod = string.IsNullOrEmpty(o.DepreciationMethod) ? "" : o.DepreciationMethod,

                        DepreciationPercentage = string.IsNullOrEmpty(o.DepreciationPercentage) ? "" : o.DepreciationPercentage,

                        UsefulLife = string.IsNullOrEmpty(o.UsefulLife) ? "" : o.UsefulLife,

                        DepreciationPeriod = string.IsNullOrEmpty(o.DepreciationPeriod) ? "" : o.DepreciationPeriod,

                        SalvageValue = string.IsNullOrEmpty(o.SalvageValue) ? "" : o.SalvageValue,

                        StartDepreciationValue = string.IsNullOrEmpty(o.StartDepreciationValue) ? "" : o.StartDepreciationValue,

                        AssetAccount = string.IsNullOrEmpty(o.AssetAccount) ? "" : o.AssetAccount,

                        AccumelatedDepreciationAccount = string.IsNullOrEmpty(o.AssetAccount) ? "" : o.AccumelatedDepreciationAccount,

                        NetBookValue = o.NetBookValue,

                        DisposalReference = string.IsNullOrEmpty(o.DisposalReference) ? "" : o.DisposalReference,

                        DisposalDate = o.DisposalDate,

                        DisposalMethod = o.DisposalMethod.ToString(),

                        ActualSalvageValue = o.ActualSalvageValue,

                        Image = o.Image,

                        ItemImprovementPlan = o.ItemImprovementPlan,

                        PrintBarcodeCount = string.IsNullOrEmpty(o.PrintBarcodeCount) ? "" : o.PrintBarcodeCount,

                        PrintQRCodeCount = string.IsNullOrEmpty(o.PrintQRCodeCount) ? "" : o.PrintQRCodeCount,

                        EffectiveDate = string.IsNullOrEmpty(o.EffectiveDate.ToString()) ? "" : o.EffectiveDate.ToString(),

                        EffectiveDateType = o.EffectiveDateType == 1 ? "InServiceDate" : "PurchasingDate",

                        DepreciationExpense = itemSerialDepreciationList.Any() ? itemSerialDepreciationList.Where(i =\> i.ItemSerialSerialValue == o.SerialValue)?.LastOrDefault()?.ItemSerialDepreciation?.ExpenseValue.ToString() : "",

                        Reason = string.IsNullOrEmpty(o.Reason) ? "" : o.Reason,

                        Filed1 = string.IsNullOrEmpty(o.Filed1) ? "" : o.Filed1,

                        Filed2 = string.IsNullOrEmpty(o.Filed2) ? "" : o.Filed2,

                        Filed3 = string.IsNullOrEmpty(o.Filed3) ? "" : o.Filed3,

                        LocationGroup = o.LocationGroupId != null ? locationGroups.Where(b =\> b.Id == (int)o.LocationGroupId).LastOrDefault().NameEnglish : "",

                        PurchaseDate = string.IsNullOrEmpty(o.PurchaseDate.ToString()) ? "" : o.PurchaseDate.ToString(),

                        DisposalField1 = !string.IsNullOrEmpty(o.DisposalField1) ? o.DisposalField1 : "",

                        DisposalField2 = !string.IsNullOrEmpty(o.DisposalField2) ? o.DisposalField2 : "",

                        DisposalField3 = !string.IsNullOrEmpty(o.DisposalField3) ? o.DisposalField3 : "",

                        DisposalNotes = !string.IsNullOrEmpty(o.DisposalNotes) ? o.DisposalNotes : "",

                        OpeningNetbookValue = string.IsNullOrEmpty(o.OpeningNetbookValue.ToString()) ? o.OpeningNetbookValue.ToString() : "",

                        UsefulLifeValue = string.IsNullOrEmpty(o.UsefulLifeValue.ToString()) ? o.UsefulLifeValue.ToString() : "",

                        IsCalculateDeprecition = o.IsCalculateDeprecition != null && (bool)o.IsCalculateDeprecition ? "True" : "False",

                        AuditUser = o.UserId != null ? \_userRepository.FirstOrDefaultAsync(long.Parse(o.UserId.ToString()))?.Result?.Name : ""

                    },

                    VendorName = string.IsNullOrEmpty(o.VendorName) ? o.VendorName : "",

                    ItemPartNumber = string.IsNullOrEmpty(o.ItemPartNumber) ? o.ItemPartNumber : "",

                    ItemLocationName = string.IsNullOrEmpty(o.ItemLocationName) ? o.ItemLocationName : "",

                    LocationClassificationId = o.LocationClassificationId,

                    LocationClassificationName = string.IsNullOrEmpty(o.Name) ? o.Name : "",

                    LocationClassificationFullPath = string.IsNullOrEmpty(o.FullPath) ? o.FullPath : "",

                    LocationClassificationLevel = o.Level,

                    RfidTagType = string.IsNullOrEmpty(o.RfidTagType.ToString()) ? o.RfidTagType.ToString() : "",

                    CountingType = string.IsNullOrEmpty(o.CountingType) ? o.CountingType : ""

                };

I am I am getting "Nullable object must have a value. ? but do know know the exact line number :

Any help is appreacited ?

c#