ArgumentOutOfRangeException

Posts   
 
    
mikeg22
User
Posts: 411
Joined: 30-Jun-2005
# Posted on: 05-May-2006 03:25:22   

I'm having a problem here and was wondering if someone can give me some clues...

I've bound an EntityCollection to a Janus Grid (3.0) and outside of the context of the grid, I add an entity to the collection and then set one of its properties. The property happens to be the same property that is being used as a SortKey in the grid. When I try and set the property, the ListChanged(ItemChanged, index) fires, makes its way into the Janus.Data classes, and throws an ArgumentOutOfRange exception for some internal ArrayList.RemoveAt(index) call.

This exception does not get raised when I either: 1) Remove the SortKey from the grid 2) Set a property other than the one the SortKey relies on. 3) Set the property on the entity before it is added to the EntityCollection. Unfortunately I cannot consistently reproduce this in a test app.

Help!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 05-May-2006 09:47:36   

The exception is thrown in LLBLGen Pro code or in the janus grid code? I know they use obfuscation, but it might be handy to have a stacktrace simple_smile

Frans Bouma | Lead developer LLBLGen Pro
mikeg22
User
Posts: 411
Joined: 30-Jun-2005
# Posted on: 05-May-2006 19:10:10   

Otis wrote:

The exception is thrown in LLBLGen Pro code or in the janus grid code? I know they use obfuscation, but it might be handy to have a stacktrace simple_smile

Here's the trace. I should mention that this didn't happen with the V2 version of the Janus Grid. Also, the ListChangedEventArgs has "ItemChanged" and the index is the index of the newly added entity in the collection.


---- Stack Trace ----
   System.Collections.ArrayList.RemoveAt(index As Int32)
       CODA GUI.EXE: N 2774149
   Janus.Data.JanusRowCollection.c( As JanusRow)
       CODA GUI.EXE: N 00060
   Janus.Data.JanusDataRow.b()
       CODA GUI.EXE: N 00092
   Janus.Data.DataHolderRow.b()
       CODA GUI.EXE: N 00101
   Janus.Data.TableListHolderRow.d( As Int32)
       CODA GUI.EXE: N 00091
   Janus.Data.TableListHolderRow.a( As ListChangedEventArgs)
       CODA GUI.EXE: N 00050
   Janus.Data.TableListHolderRow.a( As Object,  As ListChangedEventArgs)
       CODA GUI.EXE: N 00146
   System.Windows.Forms.CurrencyManager.OnListChanged(e As ListChangedEventArgs)
       CODA GUI.EXE: N 00022
   System.Windows.Forms.CurrencyManager.List_ListChanged(sender As Object, e As ListChangedEventArgs)
       CODA GUI.EXE: N 01302
   System.ComponentModel.ListChangedEventHandler.Invoke(sender As Object, e As ListChangedEventArgs)
       CODA GUI.EXE: N 00000
   System.Windows.Forms.BindingSource.OnListChanged(e As ListChangedEventArgs)
       CODA GUI.EXE: N 00122
   System.Windows.Forms.BindingSource.InnerList_ListChanged(sender As Object, e As ListChangedEventArgs)
       CODA GUI.EXE: N 00045
   System.ComponentModel.ListChangedEventHandler.Invoke(sender As Object, e As ListChangedEventArgs)
       CODA GUI.EXE: N 00000
   SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase2.OnListChanged(index As Int32, typeOfChange As ListChangedType)
       EntityCollectionBase2.cs: line 1603, col 05, IL 0044
   SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase2.EntityInListOnEntityContentsChanged(sender As Object, e As EventArgs)
       EntityCollectionBase2.cs: line 1620, col 05, IL 0035
   SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.FlagMeAsChanged()
       EntityBase2.cs: line 0857, col 05, IL 0027
   SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.PostFieldValueSetAction(fieldValueSet As Boolean)
       EntityBase2.cs: line 1434, col 05, IL 0064
   CODA.SupportClasses.Security.SecureEntityBase.PostFieldValueSetAction(fieldValueSet As Boolean)
       SecureEntityBase.vb: line 0049, col 04, IL 0001
   CODA.Entities.EntityClasses.EmployeeEmploymentAction.SetNewFieldValue(fieldIndex As Int32, value As Object)
       EmployeeEmploymentAction.designer.vb: line 0435, col 05, IL 0262


Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 05-May-2006 20:46:14   

Hmm... and you can't reproduce this every time?

Frans Bouma | Lead developer LLBLGen Pro
mikeg22
User
Posts: 411
Joined: 30-Jun-2005
# Posted on: 05-May-2006 20:51:57   

Otis wrote:

Hmm... and you can't reproduce this every time?

Well, here's the story. I originally made a test app that could reproduce the problem. I realized that I was compiling your ORMSupportClasses without the DOTNET20 compiler flag, so I did this and it fixed the problem...for the test app, but not our real app!

However, in our app, I can consistently reproduce the problem. We have a temporary fix right now where we set RaiseListChangedEvents=False for the bindingsource tied to the Grid. We set this when we are going to add a new entity (and set one of its properties that is part of the Grid's sortkeycollection).

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 06-May-2006 11:00:31   

If you compile the runtimelibs yourself, have you made any changes yourself?

Frans Bouma | Lead developer LLBLGen Pro
mikeg22
User
Posts: 411
Joined: 30-Jun-2005
# Posted on: 06-May-2006 18:00:31   

Otis wrote:

If you compile the runtimelibs yourself, have you made any changes yourself?

No, it just makes it easier to step through the code. I get the problem also when I'm pointing directly at your compiled DLLs.

The only difference I can think of is that we are using templates that were manually upgraded to 2005 version from the original 2004 version. I'm afraid that we left something vital out, or left something in that should have been removed. I hate to ask other's time to correct our coding mistakes, so I'm just hoping that someone with more knowledge of the complex databinding process might be able to make some guesses about what could cause that exception to be raised.

If it comes down to it, I suppose we will just start with the 2005 templates and work from there, although this could be pretty painful disappointed

sparmar2000 avatar
Posts: 341
Joined: 30-Nov-2003
# Posted on: 07-May-2006 18:38:44   

f it comes down to it, I suppose we will just start with the 2005 templates and work from there, although this could be pretty painful Dissapointed

If you suspect that manual upgrading to 2005 might have not gone as expected, then I suspect, even if you fix this problem, you might hit another one.

Seems to me that it might 'simpler' and better in the long run to do as you suggest in the quote.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 07-May-2006 20:34:05   

Winmerge or other diff program is of great help in these kind of situations. I use winmerge as well if I need to find out if a file has changed / have to compare it with another file. (if it's not in subversion, otherwise I ise tortoisesvn's merge tool ).

Frans Bouma | Lead developer LLBLGen Pro
mikeg22
User
Posts: 411
Joined: 30-Jun-2005
# Posted on: 08-May-2006 22:54:16   

Otis wrote:

Winmerge or other diff program is of great help in these kind of situations. I use winmerge as well if I need to find out if a file has changed / have to compare it with another file. (if it's not in subversion, otherwise I ise tortoisesvn's merge tool ).

Just downloaded Winmerge and have been playing around with it a bit. Seems very useful! However, we don't have the time right now to redo our templates, hopefully some time in the future. For now we have a workaround by turning binding off in the grid. Thanks for your help simple_smile