StrataFrame Forum

Possible SharedDataTableKey Bug?

http://forum.strataframe.net/Topic21261.aspx

By Richard Keller - 12/17/2008

If I open a second instance of a prior opened form I get the following error when using SharedDataTableKey?   Should I be aware of something?  It looks like the Key is already there?

ArgumentException
  An item with the same key has already been added.

Source     : mscorlib

Stack Trace:
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at MicroFour.StrataFrame.Business.BusinessBindingSource.CreateShareAndAddBusinessObject(Int32 index)
   at MicroFour.StrataFrame.Business.BusinessBindingSource.get_Item(Int32 index)
   at System.Windows.Forms.CurrencyManager.OnCurrentChanged(EventArgs e)
   at System.Windows.Forms.CurrencyManager.ChangeRecordState(Int32 newPosition, Boolean validating, Boolean endCurrentEdit, Boolean firePositionChange, Boolean pullData)
   at System.Windows.Forms.CurrencyManager.List_ListChanged(Object sender, ListChangedEventArgs e)
   at MicroFour.StrataFrame.Business.BusinessBindingSource.OnListChanged(ListChangedEventArgs e)
   at MicroFour.StrataFrame.Business.BusinessBindingSource.BusinessObject_CurrentDataTableRefilled()
   at MicroFour.StrataFrame.Business.BusinessLayer.raise_CurrentDataTableRefilled()
   at MicroFour.StrataFrame.Business.BusinessLayer.OnCurrentDataTableRefilled()
   at MicroFour.StrataFrame.Business.BusinessLayer.set_SharedDataTableKey(String value)
   at RazorSoft.MultiShip.UI.ShipperSetupForm.InitializeComponent() in C:\Documents and Settings\Richard\My Documents\Visual Studio 2005\Projects\Multiship\RazorSoft.MultiShip\RazorSoft.MultiShip.UI\Forms\Setup\ShipperSetupForm.Designer.vb:line 368
   at RazorSoft.MultiShip.UI.ShipperSetupForm..ctor() in C:\Documents and Settings\Richard\My Documents\Visual Studio 2005\Projects\Multiship\RazorSoft.MultiShip\RazorSoft.MultiShip.UI\Forms\Setup\ShipperSetupForm.vb:line 5
   at RazorSoft.MultiShip.Application.frmAppMain.ShippersToolStripMenuItem_Click(Object sender, EventArgs e) in C:\Documents and Settings\Richard\My Documents\Visual Studio 2005\Projects\Multiship\RazorSoft.MultiShip\RazorSoft.MultiShip.Application\frmAppMain.vb:line 61
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m)
   at System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

By Trent L. Taylor - 12/18/2008

This is a very heavily used mechanism within the framework.  So more than likely there is probably something within your code that is forcing the error.  You could also be doing something that is not being accounted for, so if you could provide a sample that reproduces the problem that would be very helpful.  Thanks.