1

Closed

InvalidOperationException in DataAccess.Core.ObjectBuilder.BuildObject

description

A select operation which is to return anonymous type objects causes InvalidOperationException in DataAccess.Core.ObjectBuilder.BuildObject.
 
An example of the type of select that triggers the bug:
var data = DStore.Query<Bug>().Select(b => new { label = b.Id });
 
Exception detail:
System.InvalidOperationException occurred
Message=Sequence contains no elements
Source=System.Core
StackTrace:
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at DataAccess.Core.ObjectBuilder.BuildObject(IDataStore dstore, QueryData dt, TypeInfo ti, Int32 i) in c:\WorkingDirectory\SauceDB\DataAccess.Core\ObjectBuilder.cs:line 33
InnerException:
Closed Jan 29, 2014 at 12:29 PM by iamkrillin
this has been fixed for a while, kinda forgot about it

comments

aknuds1 wrote Aug 25, 2011 at 2:10 PM

I found that replacing the lambda with a delegate avoids the bug (I get the expected results):

var data = DStore.Query<Bug>().Select(delegate(Bug b) { return new {label = b.Id}; });

wrote Feb 14, 2013 at 2:41 AM

wrote Jan 29, 2014 at 12:29 PM