'Object reference not set to an instance of an object.' in .Net core mvc

Viewed 36

I'm getting ‍Object reference not set to an instance of an object in following code

hbprint = await _vw_BPS.FindAsync(x => x.Id == id);

foreach (var hbs in hbprint.Vw_hcsp)          
{   
    var stock = await _vw_hcsp.FindAsync(x=> x.HId == id);
          
    var svm= new Vw_hcsp
    {
        HId = stock.HId,
        HBLContainerId = stock.HBLContainerId,
        Chassis_No = stock.Chassis_No,
        ContainerNo = stock.ContainerNo,
        Seal_No = stock.Seal_No,
        Vehicle_Model = stock.Vehicle_Model,
        Gross_Weight_Stock = stock.Gross_Weight_Stock,
        Volume_Stock = stock.Volume_Stock
     };
}
0 Answers
Related