StrataFrame Forum
Back
Login
Login
Home
»
StrataFrame Application Framework - V1
»
Business Objects and Data Access (How do I?)
»
.NewRow() Error - An Item with the same key has already been added.
.NewRow() Error - An Item with the same key has already been added.
Post Reply
Like
2
.NewRow() Error - An Item with the same key has already been added.
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
jsantos
jsantos
posted 10 Years Ago
ANSWER
HOT
Topic Details
Share Topic
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?
Reply
Like
2
Replies
jsantos
jsantos
posted 10 Years Ago
ANSWER
Post Details
Share Post
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.
Reply
Like
2
StrataFrame Team
S
StrataFrame Team
posted 10 Years Ago
ANSWER
Post Details
Share Post
S
Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
Woot! Glad you're fixed. Let us know when you need help on your next gremlin.
Reply
Like
1
Edhy Rijo
E
Edhy Rijo
posted 10 Years Ago
ANSWER
Post Details
Share Post
E
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
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
Reply
Like
1
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Threaded View
Threaded View
.NewRow() Error - An Item with the same key has already been added.
jsantos
-
10 Years Ago
Hi JSantos, I your screenshot is not quite visible, it is always best...
Edhy Rijo
-
10 Years Ago
Sorry about the image. Added attachment We are adding a new row...
jsantos
-
10 Years Ago
Hi, Thanks for the image and yes, NewRow() is recommended for adding...
Edhy Rijo
-
10 Years Ago
I have attached a screenshot of the code that I think you will see...
jsantos
-
10 Years Ago
Howdy J, The CreateShareAndAddBusinessObject() method is called from...
StrataFrame Team
-
10 Years Ago
By the way, calling .Add() calls .NewRow() internally. Calling .Add()...
StrataFrame Team
-
10 Years Ago
I have also just tried using .Add and I get the same error in the same...
jsantos
-
10 Years Ago
Hi Ben, Thanks for the information. So I put a break point on...
jsantos
-
10 Years Ago
Yeah, that double call is what's causing the error. Will you send me a...
StrataFrame Team
-
10 Years Ago
I thought I would do one better and provide the 2 call stacks in one...
jsantos
-
10 Years Ago
OK, it looks like setting a value on the row is causing the...
StrataFrame Team
-
10 Years Ago
Hi JSantos and Ben, One thing to keep in mind is that in your msd BO...
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
Thanks both of you your help. Unfortunately neither suggestions...
jsantos
-
10 Years Ago
OK so when I commented all filtering of the msd BO I get no error at...
jsantos
-
10 Years Ago
Yes, there should be at least 1 record in the BO after .NetRow() if...
StrataFrame Team
-
10 Years Ago
Ok more info. I stepped through the code in .NewRow() and actually...
jsantos
-
10 Years Ago
Awesome!! So following both your comments it looks like this...
jsantos
-
10 Years Ago
Woot! Glad you're fixed. Let us know when you need help on your next...
StrataFrame Team
-
10 Years Ago
Hi JSantos, Ben, Wow it must have been a long night for you JSantos...
Edhy Rijo
-
10 Years Ago
Post Reply
Like
2
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search