developerforce/Force.com-Toolkit-For-Windows-Azure — Issue #1: NullReferenceException when query result is empty
Author: phw
Created: 2011-11-14 11:01:59+00:00
State: open

I had the problem that I got a null reference exception in DatabaseDotComClient.Query if the query returned an empty result.

I am currently using the patch at https://github.com/phw/Force.com-Toolkit-For-Windows-Azure/commit/4d80102105cbc72dd5139c053d395ff7b33c881b to fix the problem.

Below is the relevant part of the stack trace when the error occurred:

System.NullReferenceException: Object reference not set to an instance of an object. at DatabaseDotCom.DatabaseDotComClient.QueryResult.MakeRecords(sObject[] sObjects) in Library\DatabaseDotCom\DatabaseDotComClient.cs:line 181 at DatabaseDotCom.DatabaseDotComClient.QueryResult..ctor(QueryResult qr) in Library\DatabaseDotCom\DatabaseDotComClient.cs:line 147 at DatabaseDotCom.DatabaseDotComClient.Query(String soql) in Library\DatabaseDotCom\DatabaseDotComClient.cs:line 52 at ...