Microsoft.Xrm.Sdk.Async icon indicating copy to clipboard operation
Microsoft.Xrm.Sdk.Async copied to clipboard

Failed Request Returns default Instead of Throwing

Open ChrisGrohHS opened this issue 5 years ago • 0 comments

Unknown exceptions cause the process to return default(T) instead of throwing. For example, the following code will generate a FaultException and return a null response.

var query = new QueryExpression("account");
query.Criteria.AddCondition("primarycontactid", ConditionOperator.Equal, new EntityReference("account", Guid.NewGuid()));
var response = await service.RetrieveMultipleAsync(query);
// response is null. 

This could be especially painful to troubleshoot for requests that callers might not normally check the response for like a Create or WinOpportunityRequest.

ChrisGrohHS avatar Feb 06 '19 15:02 ChrisGrohHS