System.ArgumentOutOfRangeException in mscorlib.dll

Posts   
 
    
bert
User
Posts: 42
Joined: 05-Jun-2005
# Posted on: 12-Jun-2005 04:46:33   

Hi,

I'm new to this and currently evaluating LLBLGen Pro. We are very excited and everything's great in terms of what it can do for us. We're likely to go ahead and purchase soon. simple_smile

I've struck this problem and it really annoys me. I have an entity collection bound to an Infragistics TreeView used to open and edit Entities bound to the view. When editing you can change which tree branch (trusts in this case) the entity belongs to. When the trust changes on a venue entity I refresh the treeview and in most cases this works just dandy.

However in some cases the above exception is thrown in UnsetRelatedEntity when I change the trust relation on the venue entity (I set VenueEntity.Trust = newTrust). It's telling me it's trying to remove a non existing entry (the venue entity) from the trust collection (the exception is thrown in the trust entity which is the parent entity of venue). I even added an if statement to check if the venue was there and it appears that it was, the remove still throws this exception. confused

Can anyone help a beginner please?

Thanks Bert

 if (this.Venues.Contains(relatedEntity))
                    {
                        this.Venues.Remove(relatedEntity);  
                    }
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 12-Jun-2005 14:30:39   

What's the date of the demo you're using (in the about box). ? It could be related to a bug which was fixed on May 23rd 2005. That bug caused the events to be fired before something was actually changed, which could confuse the currency manager on your form and therefore make the control act weird.

If your demo shows a date in the about box of May 23rd or later, please let me know. Otherwise you can fix this by re-downloading the demo, re-generate your code and retry. Please let me know if you run into (other) problems with this.

Frans Bouma | Lead developer LLBLGen Pro
bert
User
Posts: 42
Joined: 05-Jun-2005
# Posted on: 12-Jun-2005 15:45:22   

Thanks for this,

The date is actually May 26th , so I don't think this applies. Also, the events seems to fire OK. It's just occassionally I get this error. For some reason it was always related to a branch in the tree with two entries and it always happened on the second one.

Bert

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 12-Jun-2005 17:09:17   

bert wrote:

The date is actually May 26th , so I don't think this applies. Also, the events seems to fire OK. It's just occassionally I get this error. For some reason it was always related to a branch in the tree with two entries and it always happened on the second one.

Hmm. These things are hard to track down, though I guess it's because a de-reference of the current entity occurs -> event is fired -> treeview tries to update itself -> one entity is missing -> error. The exception occurs in the generated code or in the treeview? I've the 2004.1 winforms Infragistics controls here, I could try to see if I can reproduce it here (I assume you're using SelfServicing?), to see what's wrong. (Say I bind customers to the treeview, and I have a customer with 2 orders (so 2 subnodes below customer), and I set the second order to another customer it should fail? )

Frans Bouma | Lead developer LLBLGen Pro
bert
User
Posts: 42
Joined: 05-Jun-2005
# Posted on: 13-Jun-2005 00:38:15   

Hi again,

I 'm actually using Vol 2005.2, that's the first release where the tree view has data binding, so I think it will be a bit hard for you to reprodcue exactly.

It's the generated code that breaks, the TrustEntity code which has a Venues collection, the venue in question is the one being moved from one trust to another, the add has taken place (I traced the code) and then it's trying to remove the venue from the leaving trust and that's where the exception is thrown.

The funny thing is that when I added the if statement (see my little code snippet) to check if the venue was in the collection, IT's THERE and the if is true, then when the remove is executed it throws an exception using the same venue object. It's wierd all right.

Anyway, I will try to confine and reproduce this better and will post back when that's done (or the problem is fixed sunglasses ).

Bert

PS By the way I'm running the adapter scenario.

bert
User
Posts: 42
Joined: 05-Jun-2005
# Posted on: 13-Jun-2005 03:24:00   

Ok problem solved (sort of),

I was actually an issue with the Infragistics treeview event handling the remove call from the generated code. Everything's fine in the generated code and it's behaving correctly. The treeview throws an index out of range exception when it's trying to remove the entry from the tree (it only happens occassionally though).

I think I have to contact Infragistics about this one as it actually has happened before when I cleared a datatset bound to their grid, it threw the same exception.

This problem I could easily work around as I refreshed the tree completely anyway after this change so I just added an unbinding call (SetDataBinding(null, null)) before I assigned the property. The unrelated Dataset problem I had to create a new dataset instead and go through some extra init logic so that cost a bit of performance.

Your product is great, sorry to bother you, now onto better and greater things. wink

Thanks for listening.

Bert

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 13-Jun-2005 09:59:02   

bert wrote:

Ok problem solved (sort of),

I was actually an issue with the Infragistics treeview event handling the remove call from the generated code. Everything's fine in the generated code and it's behaving correctly. The treeview throws an index out of range exception when it's trying to remove the entry from the tree (it only happens occassionally though).

I think I have to contact Infragistics about this one as it actually has happened before when I cleared a datatset bound to their grid, it threw the same exception.

Ok! simple_smile 2005.2 sounds very new, so they must have overlooked something I guess. These things are hard to track down though... events going off everywhere, and if something isn't done in the right order, databinding falls apart.

This problem I could easily work around as I refreshed the tree completely anyway after this change so I just added an unbinding call (SetDataBinding(null, null)) before I assigned the property. The unrelated Dataset problem I had to create a new dataset instead and go through some extra init logic so that cost a bit of performance.

Glad you can work around it simple_smile

Your product is great, sorry to bother you, now onto better and greater things. wink

smile

Frans Bouma | Lead developer LLBLGen Pro