0

I am hunting down a Object reference not set to an instance of an object error and I have narrowed it down to this piece of code

 var store = await _storeService.GetStoreById(brand, storeId);
            var scanDeviceDataEntryInput = new ScanDeviceDataEntryInputModel
            {
                IdScope = store.IoTScannerIdScope,
                DeviceId = store.IoTScannerDeviceId,
                DeviceKey = store.IoTScannerDeviceKey,
                ScanDeviceTemplateValues = new ScanDeviceTemplateValues()
            };

What happens here if the GetStoreById which is a DB search, searches a DB entry that does not have the 3 needed properties in the store object? will that case the null reference value for example if the IoTScannerIdScope does not exist in the CosmosDB document that is being returned?

And if so how do I solve that?

Matt Douhan
  • 677
  • 3
  • 13

0 Answers0