Print Page | Close Window

Exception in GetEnumerator

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2533
Printed Date: 13-May-2026 at 6:38pm


Topic: Exception in GetEnumerator
Posted By: jsobell
Subject: Exception in GetEnumerator
Date Posted: 27-Feb-2011 at 6:45pm
An IdeaBlade exception is thrown in (non-SilverLight) code when compound primary key contains NULL.
We have a simple view on our database with an outer join, and in flagging the fields we thought was a unique key, it turns out that one element could be NULL due to the OUTER clause.  This raises an internal exception when the enumerator is fetched.
While this is a situation to avoid, it's extremely difficult to identify the cause of the exception, sp perhaps it needs either a check internally so meaningful feedback can be displayed?

Cheers,
 Jason

                    var datarows = from datarow in _context.ExportAllResponseDatas
                                   where datarow.QuestionnaireVersionId == qversionid
                                         && datarow.LastUpdated <= _snapshotTime
                                         && (datarow.ResponseState.HasValue && datarow.ResponseState.Value != 1)
                                   orderby datarow.ResponseSetID
                                   select datarow;

                    var dataenumerator = datarows.GetEnumerator();

Exception trace is show below.

IdeaBlade.EntityModel.EntityServerException: {"Object reference not set to an instance of an object."}

StackTrace:
   at IdeaBlade.EntityModel.EntityManager.HandleEntityServerException(Exception ex, Boolean tryToHandle, PersistenceOperation operation, Boolean throwOnError)
   at IdeaBlade.EntityModel.EntityManager.ExecuteServerQuery(IEntityQuerySurrogate entityQuery)
   at IdeaBlade.EntityModel.EntityManager.ExecuteFetch(IEntityFinder finder)
   at IdeaBlade.EntityModel.EntityQueryFinder.Execute()
   at IdeaBlade.EntityModel.EntityManager.ExecuteQueryCore(IEntityQuery query, Boolean isAsync)
   at IdeaBlade.EntityModel.EntityManager.ExecuteQuery[T](IEntityQuery`1 query)
   at IdeaBlade.EntityModel.EntityQueryExtensions.Execute[T](IEntityQuery`1 query)
   at IdeaBlade.EntityModel.EntityQuery`1.GetEnumerator()
   at QuestMetrics.QuestServer.DataExportService.DataExporterBase.ExportData(Func`2 progresscallback) in C:\Source\Stuff\DataExporterBase.cs:line 320

InnerException:
   at IdeaBlade.EntityModel.EntityServerProxy.CheckConnection(Exception e)
   at IdeaBlade.EntityModel.EntityServerProxy.Fetch(SessionBundle bundle, IEntityQuerySurrogate query)
   at IdeaBlade.EntityModel.EntityManager.ExecuteServerQuery(IEntityQuerySurrogate entityQuery)






Replies:
Posted By: DenisK
Date Posted: 28-Feb-2011 at 10:58am
Hi jsobell;

Thanks for the feedback. Let me try to repro this and file a bug report as needed.



Print Page | Close Window