The given key was not present in the dictionary error


Author
Message
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Ok...I got there. I am now running on SF 1.7.0 and DevEx 9.1.5. Of course, I do still have that RemoveBOHandlers method commented out in the BBS class. I am going to make a couple of quick changes to other areas in my application, run some tests, then post the update. Looks like I am back in business!



w00t
Peter Jones
Peter Jones
Advanced StrataFrame User (514 reputation)Advanced StrataFrame User (514 reputation)Advanced StrataFrame User (514 reputation)Advanced StrataFrame User (514 reputation)Advanced StrataFrame User (514 reputation)Advanced StrataFrame User (514 reputation)Advanced StrataFrame User (514 reputation)Advanced StrataFrame User (514 reputation)Advanced StrataFrame User (514 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi Trent,



I just want to confirm that you guys are 'on the case'. We have also commented out that line of code that Bill highlighted and now our app works ok with SF 1.7 and DX 9.1.5. but what are the side effects (if any) of doing this?



Cheers, Peter
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
It looks like this is ONLY happening on DevExpress grids version 9.x and greater. So something apparently changed. Instead of getting in contact with DevExpress, etc. we went ahead and made a code change in the event that another 3rd party control references an IBindingList implementation during disposal.



Ultimately this is a simple fix, but the reason for all of the confusion was due to different versions of a 3rd party control acting different ways. The next minor release posted will include this fix, but you can go ahead and change the source if you like temporarily. You WILL NOT have to maintain this source as it has already been changed. But the issue is that the _BusinessObject has already been disposed, thus when the grid implicitly attempts to dispose of the data source, an error occurs. Here is the code as it should be to resolve the error:



BusinessBindingSource, RemoveBOHandlers()



'''

''' Removes the necessary event handlers from the business object.

'''


'''

Private Sub RemoveBOHandlers()

'-- Make sure that the BO has a reference

If _BusinessObject Is Nothing Then Return



Try

'-- Remove the necessary handlers

RemoveHandler Me._BusinessObject.AfterAddNew, AddressOf BusinessObject_InternalAfterAddNew

RemoveHandler Me._BusinessObject.BeforeAddNew, AddressOf BusinessObject_InternalBeforeAddNew

RemoveHandler Me._BusinessObject.InternalAfterAddNew, AddressOf BusinessObject_InternalAfterAddNew

RemoveHandler Me._BusinessObject.CurrentDataTableRefilled, AddressOf BusinessObject_CurrentDataTableRefilled

RemoveHandler Me._BusinessObject.CurrentView.ListChanged, AddressOf BusinessObject_CurrentView_ListChanged

RemoveHandler Me._BusinessObject.Navigated, AddressOf BusinessObject_Navigated

RemoveHandler Me._BusinessObject.IsDirtyChanged, AddressOf BusinessObject_IsDirtyChanged

Catch ex As Exception

End Try

End Sub

Edhy Rijo
E
StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Trent,



I am happy to say that I made the changes posted before to the BusinessBindingSource, RemoveBOHandlers() and that fix the error or as you would say "Smoke it!!!!".



WARNING.... I just tested it once Hehe

Edhy Rijo

Jeff Pagley
Jeff Pagley
StrataFrame User (467 reputation)StrataFrame User (467 reputation)StrataFrame User (467 reputation)StrataFrame User (467 reputation)StrataFrame User (467 reputation)StrataFrame User (467 reputation)StrataFrame User (467 reputation)StrataFrame User (467 reputation)StrataFrame User (467 reputation)
Group: StrataFrame Users
Posts: 223, Visits: 893
Hi SF Team,

I understand where to make the change but I am running VS 2005 and the Microfour Strataframe.sln is not loading.   I have loaded the Microfour Strataframe Inherited IU project and updated the DevExpress references to v9.1.5 and created the new DLL successfully.  I tried loading the Microfour Strataframe Business project, but I get over 100 errors.  I am not sure what to do now.  What are the steps I need to take to implement this fix or will you post a new dll with this fix?

Thanks,

Jeff

Jeff Pagley
Jeff Pagley
StrataFrame User (467 reputation)StrataFrame User (467 reputation)StrataFrame User (467 reputation)StrataFrame User (467 reputation)StrataFrame User (467 reputation)StrataFrame User (467 reputation)StrataFrame User (467 reputation)StrataFrame User (467 reputation)StrataFrame User (467 reputation)
Group: StrataFrame Users
Posts: 223, Visits: 893
Hi SF,

What is the status to my last post?

Thanks,

Jeff

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Sorry for the delayed responses. We have not been in the office the last several days for personal reasons.



At any rate, I am doing a new build - 1.7.0.1. This will include these changes for you. I will post it in the My Account area as soon as it is ready.
Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)
Group: Forum Members
Posts: 153, Visits: 462
Trent, I am also getting this same error on a form that has worked until the upgrade to 1.7.0. There are no third party controls on this form. Just StrataFrame and Grids. One of them has a BBS. Is there a quick fix for this? or do I need to download 1.7.0.1?

The error:

Source     : mscorlib

 

Stack Trace:

   at System.ThrowHelper.ThrowKeyNotFoundException()

   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)

   at MicroFour.StrataFrame.Business.BusinessLayer.get__CurrentDataTable(Boolean IsSharedTable)

   at MicroFour.StrataFrame.Business.BusinessBindingSource.RemoveBOHandlers()

   at MicroFour.StrataFrame.Business.BusinessBindingSource.Dispose(Boolean disposing)

   at System.ComponentModel.Component.Dispose()

   at System.ComponentModel.Container.Dispose(Boolean disposing)

   at System.ComponentModel.Container.Dispose()

   at TrustedVALET.forms.order.frmOrder.Dispose(Boolean disposing) in C:\TrustedVALET\TrustedVALET\forms\order\frmOrder.Designer.cs:line 12

   at System.Windows.Forms.Form.WmClose(Message& m)

   at System.Windows.Forms.Form.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)

 

The error is not very helpful as you can see the 2nd line in the stack trace is:

 

   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)

 

Edhy Rijo
E
StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Ross L. Rooker, Sr. (08/16/2009)
Is there a quick fix for this? or do I need to download 1.7.0.1?




Hi Ross,



I would try 1.7.0.1 first.

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Ross,



I am assuming that you are using DevExpress grids or something along those lines. Yes, please download the 1.7.0.1 build as we made a change to prevent any 3rd party control that references the IBindingList interface during or after disposal.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search