You are right. Every extension methods from System.Linq that takes Reference types will check if they are null if(source== null) and throw a ArgumentNullException if they are.
In case of your, following service method returning run and causing issue:
_service.GetDoc()
Please check for null or use null-able operator as:
var result = _service.GetDoc()?.FirstOrDefault();
if(result!=null){
//do whatever
}
Posted On:
15-Apr-2020 23:20