New Posts New Posts RSS Feed: InvalidOperation Exception when saving
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

InvalidOperation Exception when saving

 Post Reply Post Reply
Author
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Topic: InvalidOperation Exception when saving
    Posted: 04-Jan-2011 at 1:23am
No problem. Thanks for sharing your solution.
Back to Top
mmedic View Drop Down
Newbie
Newbie


Joined: 02-Jan-2011
Posts: 4
Post Options Post Options   Quote mmedic Quote  Post ReplyReply Direct Link To This Post Posted: 03-Jan-2011 at 8:14pm
I think I figured it out. I was trying to delete an object graph in the collection changed event handler which did not work. Once I moved the Delete() outside the event handler code, everything worked OK. Thanks for your help!
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 03-Jan-2011 at 6:31pm
Could you try deleting the object graph without binding the collection to the Infragistics DataGrid in the first place?
Back to Top
mmedic View Drop Down
Newbie
Newbie


Joined: 02-Jan-2011
Posts: 4
Post Options Post Options   Quote mmedic Quote  Post ReplyReply Direct Link To This Post Posted: 03-Jan-2011 at 6:18pm
I looked at this some more and actually the error is happening when I call Entity.Delete() method as a part of deleting the object graph. There is noting that is modifying the collection at tha time but the collection was bound to an Infragtistics DataGrid and unbound prior to Delete() call. Any ideas?
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 03-Jan-2011 at 3:34pm
mmedic;

I've tried to repro but was not able to as well. Here's what reentrant means from Wikipedia. 


In the context of this issue, this exception can occur if you have a RelatedEntityList<T> and you are making a change to that list using either Clear(), Add(), Remove() and/or RemoveAt() methods. And while that change is still being made, another change is executed.

In your case, you have a Book with a RelatedEntityList<Isbn>. My suggestion is to check whether there's another Add, Clear, and/or Remove operation that is being executed while you're deleting the Book's object graph.

Hope this helps.
Back to Top
mmedic View Drop Down
Newbie
Newbie


Joined: 02-Jan-2011
Posts: 4
Post Options Post Options   Quote mmedic Quote  Post ReplyReply Direct Link To This Post Posted: 03-Jan-2011 at 11:33am
I am not sure that I'll be able to recreate it using the NorthwindIB database. I'm trying to get information on what this exception means as it may be something I'm doing wrong in my code. I could not find any documentation about the exception or concept or reentrance. The method throwing the exception is CheckReenatrance().
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 03-Jan-2011 at 11:21am
Hi mmedic;

Could you provide a repro solution using NorthwindIB database? Thank you.
Back to Top
mmedic View Drop Down
Newbie
Newbie


Joined: 02-Jan-2011
Posts: 4
Post Options Post Options   Quote mmedic Quote  Post ReplyReply Direct Link To This Post Posted: 02-Jan-2011 at 9:59pm
I have a Book object in my model that contains a list of Isbn objects. When I try to delete a whole graph of Book (including the Isbn object), I get a "RelatedEntityList's are not reentrant" message. I've never seen that before and could not dig up anything on the net. Any ideas why this error is occurring?
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down