yasser777 / nettiers

Automatically exported from code.google.com/p/nettiers
0 stars 0 forks source link

Website Admin: Update Entity - Item has already been added. Key in dictonary #266

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Starting with a default CodeSmith build of a small db. E.g. with
Articles and Categories tables.
2. Running the Website: Admin/Articles.aspx -> Select an article to edit.
3. Make a change to a field, then click "Update".

What is the expected output? What do you see instead?
This error occurs sporadically - it is not congruent. We expect it save
changes and show the edit page. Occationally we get a "Item has already
been added. Key in dictionary: 'ArticlesLib.Entities.Articles'...

What version of .netTiers and CodeSmith are you using?
.netTiers v2.3.0.812
CodeSmith 5.1.6 Revision 9466

Please provide any additional information below.
Server Error in '/' Application.
Item has already been added. Key in dictionary: 'ArticlesLib.Entities.Articles
- ArticleId: 2
- CsPageKey: some23
- ArticleTypeId: 2
- Title: First 4 price goes to 4533
- Body: sdf53343
- BodyFormatted: fsdy
- Summery: dfgd5454
- CategoryId: 1
'  Key being added: 'ArticlesLib.Entities.Articles
- ArticleId: 2
- CsPageKey: some23
- ArticleTypeId: 2
- Title: First 4 price goes to 4533
- Body: sdf53343
- BodyFormatted: fsdy
- Summery: dfgd5454
- CategoryId: 1
'
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.ArgumentException: Item has already been added.
Key in dictionary: 'ArticlesLib.Entities.Articles
- ArticleId: 2
- CsPageKey: some23
- ArticleTypeId: 2
- Title: First 4 price goes to 4533
- Body: sdf53343
- BodyFormatted: fsdy
- Summery: dfgd5454
- CategoryId: 1
'  Key being added: 'ArticlesLib.Entities.Articles
- ArticleId: 2
- CsPageKey: some23
- ArticleTypeId: 2
- Title: First 4 price goes to 4533
- Body: sdf53343
- BodyFormatted: fsdy
- Summery: dfgd5454
- CategoryId: 1
'

Source Error:

Line 665:           //shallow copy entity
Line 666:           Articles copy = new Articles();
Line 667:           existingCopies.Add(this, copy);
Line 668:           copy.SuppressEntityEvents = true;
Line 669:               copy.ArticleId = this.ArticleId;

Source File: ..ArticlesLib.Entities\ArticlesBase.generated.cs    Line: 667

Stack Trace:

[ArgumentException: Item has already been added. Key in dictionary:
'ArticlesLib.Entities.Articles
- ArticleId: 2
- CsPageKey: some23
- ArticleTypeId: 2
- Title: First 4 price goes to 4533
- Body: sdf53343
- BodyFormatted: fsdy
- Summery: dfgd5454
- CategoryId: 1
'  Key being added: 'ArticlesLib.Entities.Articles
- ArticleId: 2
- CsPageKey: some23
- ArticleTypeId: 2
- Title: First 4 price goes to 4533
- Body: sdf53343
- BodyFormatted: fsdy
- Summery: dfgd5454
- CategoryId: 1
']
   System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean
add) +7484392
   System.Collections.Hashtable.Add(Object key, Object value) +11
   ArticlesLib.Entities.ArticlesBase.Copy(IDictionary existingCopies) in
....Entities\ArticlesBase.generated.cs:667
   ArticlesLib.Entities.ArticlesBase.Clone(IDictionary existingCopies) in
....Entities\ArticlesBase.generated.cs:721
   ArticlesLib.Entities.ArticlesBase.MakeCopyOf(Object x, IDictionary
existingCopies) in ....Entities\ArticlesBase.generated.cs:752
   ArticlesLib.Entities.ArticlesBase.Copy(IDictionary existingCopies) in
....Entities\ArticlesBase.generated.cs:692
   ArticlesLib.Entities.ArticlesBase.Clone() in
....Entities\ArticlesBase.generated.cs:713
   ArticlesLib.Entities.ArticlesBase.MakeCopyOf(Object x) in
....Entities\ArticlesBase.generated.cs:735
   ArticlesLib.Entities.ArticlesEntityData.Clone() in
....Entities\ArticlesBase.generated.cs:1366
   ArticlesLib.Entities.ArticlesBase.AcceptChanges() in
....Entities\ArticlesBase.generated.cs:807

ArticlesLib.Data.SqlClient.SqlArticlesProviderBase.Update(TransactionManager 
transactionManager,
Articles entity) in ....Data.SqlClient\SqlArticlesProviderBase.generated.cs:936
   ArticlesLib.Web.Data.ProviderDataSourceView`2.ExecuteUpdate(Entity
entity) in ....Web\Data\ProviderDataSource.cs:361
   ArticlesLib.Web.Data.BaseDataSourceView`2.ExecuteUpdate(IDictionary
keys, IDictionary values, IDictionary oldValues) in
....Web\Data\BaseDataSource.cs:1583
   System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary
values, IDictionary oldValues, DataSourceViewOperationCallback callback) +92
   System.Web.UI.WebControls.FormView.HandleUpdate(String commandArg,
Boolean causesValidation) +835
   System.Web.UI.WebControls.FormView.HandleEvent(EventArgs e, Boolean
causesValidation, String validationGroup) +509
   System.Web.UI.WebControls.FormView.OnBubbleEvent(Object source,
EventArgs e) +95
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   System.Web.UI.WebControls.FormViewRow.OnBubbleEvent(Object source,
EventArgs e) +113
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +118
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String
eventArgument) +166

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBa
ckEvent(String
eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

Original issue reported on code.google.com by mos...@gmail.com on 29 Oct 2009 at 12:45

GoogleCodeExporter commented 9 years ago
Forgot to mention, this doesn't seem to happen if I enable Atlas in the website
configuration area of the .netTiers template.

Cheers.

Original comment by mos...@gmail.com on 29 Oct 2009 at 2:44

GoogleCodeExporter commented 9 years ago
Hello,

Have you updated the master page or any of the controls on the page?

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 2 Jun 2010 at 4:05