New Posts New Posts RSS Feed: OrderBy: Ideablade should throw an exception
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

OrderBy: Ideablade should throw an exception

 Post Reply Post Reply
Author
Dominique View Drop Down
Groupie
Groupie
Avatar

Joined: 28-Jun-2007
Location: Norway
Posts: 44
Post Options Post Options   Quote Dominique Quote  Post ReplyReply Direct Link To This Post Topic: OrderBy: Ideablade should throw an exception
    Posted: 27-Feb-2009 at 9:11am
Hi

I upgrade to the latest DF version (from 3.5.something to 3.6.x)  and started migrating a project in a new code tree as a maintenance task.
After I was finished to fix the references that had been changed and get my app to compile I was getting a weird error when starting the app, getting this exception

System.IndexOutOfRangeException was unhandled by user code
  Message="Index was outside the bounds of the array."
  Source="System.Data"
  StackTrace:
   at System.Data.Select.CreateIndex()   
at System.Data.Select.SelectRows()  
 at System.Data.DataTable.Select(String filterExpression, String sort)   
at IdeaBlade.Persistence.EntityQuery.FindRows(PersistenceManager pPersistenceManager)   
at IdeaBlade.Persistence.PersistenceManager.QueryEntityFinder.FindRows()   
at IdeaBlade.Persistence.PersistenceManager.MergeAndReturnUsingCache(IEntityFinder pEntityFinder, DataSet pFetchedDataSet, FixupCacheAndUpdateResultsCallback pFixupCallback, WorkState pWorkState)   
at IdeaBlade.Persistence.PersistenceManager.ProcessFetchedDataSet(DataSet pFetchedDataSet, WorkState pWorkState)   
at IdeaBlade.Persistence.PersistenceManager.XFetch(IEntityFinder pEntityFinder, WorkState pWorkState)   
at IdeaBlade.Persistence.PersistenceManager.XFetch(IEntityQuery pEntityQuery, QueryStrategy pQueryStrategy, WorkState pWorkState)   
at IdeaBlade.Persistence.PersistenceManager.XGetEntities(IEntityQuery pEntityQuery, QueryStrategy pQueryStrategy, WorkState pWorkState)   
at IdeaBlade.Persistence.PersistenceManager.GetEntities[T](IEntityQuery pEntityQuery, QueryStrategy pQueryStrategy)
   at IdeaBlade.Persistence.PersistenceManager.GetEntities[T](IEntityQuery pEntityQuery)
     [cut out calls in my app]

Because I load the data in the background it took me some time to find the source of the problem because the exception message was not very helpful.
The problem was that I had the same order clause added twice to a spanQuery I think that the ideablade framework should check for that and give a good exception as it will result to an error in the core dotnet.
code snippet that illustrated the faulty code
         aSpanQuery.AddSpan(EntityRelations.Order_OrderLines)

        aSpanQuery.AddOrderBy(Order.ShipDateEntityColumn, System.ComponentModel.ListSortDirection.Descending) -- (a)
        aSpanQuery.AddOrderBy(Order.ShipDateEntityColumn, System.ComponentModel.ListSortDirection.Descending) ' OOPS same as (a)

        Dim tmp As EntityList(Of Order) = mPersistMng.GetEntities(Of Order)(aSpanQuery) 'KABOUM!



Dominique
Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 27-Feb-2009 at 10:10am
Originally posted by Dominique


The problem was that I had the same order clause added twice to a spanQuery I think that the ideablade framework should check for that and give a good exception as it will result to an error in the core dotnet.

code snippet that illustrated the faulty code
        aSpanQuery.AddSpan(EntityRelations.Order_OrderLines)
        aSpanQuery.AddOrderBy(Order.ShipDateEntityColumn, System.ComponentModel.ListSortDirection.Descending) -- (a)
        aSpanQuery.AddOrderBy(Order.ShipDateEntityColumn, System.ComponentModel.ListSortDirection.Descending) ' OOPS same as (a)

        Dim tmp As EntityList(Of Order) = mPersistMng.GetEntities(Of Order)(aSpanQuery) 'KABOUM!


Thanks for the heads up, Dominique: I've entered this as a bug. We'll see if we can get you a better error message.

Regards
Greg Dunn
IdeaBlade

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down