Hi,
Using the 12 May 2008 Build of 2.6 Beta.
The following query against the Northwind database:
var customers = (from c in metaData.Customer
join o in metaData.Order on c.CustomerId equals o.CustomerId
select new { CustomerId = c.CustomerId, CompanyName = c.CompanyName, OrderId = o.OrderId, OrderDate = o.OrderDate });
int cCount = customers.Count();
Generates the following error:
[NullReferenceException: Object reference not set to an instance of an object.]
SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.QueryExpressionBuilder.HandleAggregateExpression(AggregateExpression expressionToHandle) +144
SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.GenericExpressionHandler.HandleExpression(Expression expressionToHandle) +203
SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.QueryExpressionBuilder.HandleExpression(Expression expressionToHandle) +118
SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.HandleExpressionTree(Expression expression) +797
SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.Execute(Expression expression) +10
SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.System.Linq.IQueryProvider.Execute(Expression expression) +14
System.Linq.Queryable.Count(IQueryable`1 source) +244
_Default.Page_Load(Object sender, EventArgs e) +1063
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
The .Count() seems to be failing. If I use int cCount = customers.ToList().Count();, then it works but is not desirable as it executes 2 complete queries.
The .Count() function works on Linq statements which return EntityCollections.
Thanks,
Shawn