.NewRow() Error - An Item with the same key has already been added.


Author
Message
jsantos
jsantos
StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)
Group: StrataFrame Users
Posts: 26, Visits: 87
Hello,

I am having an issue when calling .NewRow I get an error in the CreateShareAndAddBusinessObject function in BusinessBindingSource.vb (see attached image)

Before calling the .NewRow in our code the CurrentRowIndex = -1 which I expect as the BO should be empty. Then as soon as I call .NewRow I get an exception. When the error is thrown index = 0 when it should be 1 according to loReturn where it looks like there is already one record and then the error makes sense.

Any ideas?

http://forum.strataframe.net/Uploads/Images/c855b057-bc96-4ba1-a242-0e50.png
Replies
jsantos
jsantos
StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)
Group: StrataFrame Users
Posts: 26, Visits: 87
Awesome!!

So following both your comments it looks like this filtering is causing the issue. Just before the NewRow call I checked the filter and it was set so I set it to empty string at the beginning of the procedure and that seems to have done the trick. NO MORE ERRORS!!! (at least for now) , yippeee.

Thanks to you both Edhy and Ben. 
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Woot!  Glad you're fixed.  Let us know when you need help on your next gremlin.
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi JSantos, Ben,

Wow it must have been a long night for you JSantos thinking about this issue Hehe

I knew the combination of using filters in such a way had something to do with this issue after all and I am glad you got that figured out.

Now, it looks like you inherited this project and after this experience, I would be very careful with the miss-used of BO.Filter or child auto filtering in other part of the code.  As you have seen, the final exception being thrown by .Net not necessarily point you in the right track as to what is causing the error.

I learned over the years that StrataFrame design and logic used for the Business Object is rock solid since my applications never fail due to an internal SF error or memory leaks, it is always due to an improper used of a feature in the BO and 99% of the time a BO.Filter or BO.Sort is involve.

Enjoy!!!

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
jsantos - 10 Years Ago
Edhy Rijo - 10 Years Ago
jsantos - 10 Years Ago
Edhy Rijo - 10 Years Ago
jsantos - 10 Years Ago
StrataFrame Team - 10 Years Ago
StrataFrame Team - 10 Years Ago
jsantos - 10 Years Ago
jsantos - 10 Years Ago
StrataFrame Team - 10 Years Ago
jsantos - 10 Years Ago
StrataFrame Team - 10 Years Ago
Edhy Rijo - 10 Years Ago
                     Yep, Edhy, the WPF ICollectionView and...
StrataFrame Team - 10 Years Ago
                         Yes, Ben you are right. I remember long time ago when I was starting...
Edhy Rijo - 10 Years Ago
jsantos - 10 Years Ago
jsantos - 10 Years Ago
StrataFrame Team - 10 Years Ago
jsantos - 10 Years Ago
jsantos - 10 Years Ago
StrataFrame Team - 10 Years Ago
Edhy Rijo - 10 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search