BindingSourceRefresh InvalidCastException

BindingSourceRefresh InvalidCastException

Old forum URL:

colemn615 posted on Monday, April 05, 2010

I am using CSLA 2.4.1 and we have been using this program for over a year and out of the blue I am getting this error. Recently I added a new object and modified the form by adding a new tab and grid for the new object and I am now getting this error. When I go to check and see what is now different I am seeing a cast from a BindingSourceRefresh to the ISupportInitialize and it is throwing a cast error on the BeginInit.

I can go into the designer code and get rid of them but anytime I look at the GUI portion of the form they get put back in place. I would love to upgrade to the latest CSLA but our object generator that we use only supports up to 2.4.1.

Has anybody seen anything like this before?



Matthew Coleman

lukky replied on Tuesday, April 06, 2010


I see you mention adding a "tab" to the form, so I'm assuming you're using a TabControl.

One problem that we've had in the past with Tabs + DataBinding is that the actual controls don't get initialized until you actually display the tab on which they are located. Maybe the BindingSourceRefresh component is trying to access its associated control(s) during this time ?

Just an idea.


colemn615 replied on Tuesday, April 06, 2010

Yes, I am adding a new UltraTab to the tab collection.

What I have been doing and seems to fix it for a little while is to remove the BindingSourceRefresh and then remove the CSLA reference from the project then add a BindingSourceRefresh back to the form which adds a CSLA reference to the project.

This makes it work correctly and sometimes works for hours and all of a sudden VS puts the Inits back in the designer code. I generally haven't even changed the GUI portion and am working on the objects and casually looking at the form for one reason or another.

Copyright (c) Marimer LLC