I have an application that uses IdeaBlade DevForce Classic 3.6.10.0. I had been using the IdeaBlade components without problems for several years but afew months ago we replaced some Windows grids with DevExpress grids and we started getting a sporadic error while running the InitializeComponent method of the control. The error is raised when the code reaches the section that initializes the XtraGridBindingManager descriptors and it will not occur all the time. If the error is acknowledged and the user tries to re-open the control, the error will still be raised on the line of code following the one that triggered the previous error and so on until it eventually initializes the control without the exception being thrown. One line of code where the error occurs is
this.PaymentInvoicesXtraGridBMgr.Descriptors.Add(new IdeaBlade.UI.WinForms.DevExpressControls.XtraGridBindingDescriptor("Provider", typeof(ABELSoft.Financials.Business.Payment_Invoice), "Invoice.Billing_Provider.Provider_name", typeof(DevExpress.XtraEditors.TextEdit)))
The exception for the error is:
Date/Time: 07/15/2011 06:34:27 PM: Payments Exception at QASERVER - User: UNIBENCO\AAAA
Message: Exception has been thrown by the target of an invocation.
StackTrace: at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at IdeaBlade.Util.WeakEventHandler`2.Handler(Object pPublisher, T pArgs)
at System.ComponentModel.ListChangedEventHandler.Invoke(Object sender, ListChangedEventArgs e)
at System.ComponentModel.BindingList`1.OnListChanged(ListChangedEventArgs e)
at IdeaBlade.Util.PropertyDescriptorList.OnListChanged(ListChangedEventArgs e)
at System.ComponentModel.BindingList`1.FireListChanged(ListChangedType type, Int32 index)
at System.ComponentModel.BindingList`1.InsertItem(Int32 index, T item)
at System.Collections.ObjectModel.Collection`1.Add(T item)
at IdeaBlade.Util.PropertyDescriptorList.Add(PropertyDescriptor pDescriptor)
at IdeaBlade.UI.ViewDescriptor.Initialize(Type pObjectType, String pPropertyPath, IDataConverter pConverter)
at IdeaBlade.UI.ViewDescriptor..ctor(String pDisplayName, Type pObjectType, String pPropertyPath, IDataConverter pConverter)
at IdeaBlade.UI.WinForms.DevExpressControls.XtraGridBindingDescriptor..ctor(String pColumnTitle, Type pObjectType, String pPropertyPath, IDataConverter pConverter, Type pControlType)
at ABELSoft.Financials.User.Controls.PaymentsCtrl.InitializeComponent()
at ABELSoft.Financials.User.Controls.PaymentsCtrl..ctor(Object Parameter1, Object Parameter2, Object Parameter3, Object Parameter4, Object Parameter5, Object Parameter6)
Base Exception: System.ArgumentException: DataMember property 'Payment_Invoices' cannot be found on the DataSource.
at System.Windows.Forms.ListBindingHelper.GetListItemProperties(Object dataSource, String dataMember, PropertyDescriptor[] listAccessors)
at System.Windows.Forms.BindingSource.GetItemProperties(PropertyDescriptor[] listAccessors)
at System.Windows.Forms.ListBindingHelper.GetListItemProperties(Object list)
at System.Windows.Forms.BindingSource.IsDataMemberValid()
at System.Windows.Forms.BindingSource.ClearInvalidDataMember()
at System.Windows.Forms.BindingSource.ParentCurrencyManager_MetaDataChanged(Object sender, EventArgs e)
at System.Windows.Forms.CurrencyManager.OnMetaDataChanged(EventArgs e)
at System.Windows.Forms.CurrencyManager.List_ListChanged(Object sender, ListChangedEventArgs e)
at System.Windows.Forms.BindingSource.OnListChanged(ListChangedEventArgs e)
at System.Windows.Forms.BindingSource.InnerList_ListChanged(Object sender, ListChangedEventArgs e)
at IdeaBlade.Persistence.ReadOnlyEntityList`1.InnerList_ListChangedHandler(Object sender, ListChangedEventArgs e)
The DataMember property is not being assigned during the Initialize method, and I have tried the following:
1. Remove the DataMember properties from the designer so that the controls do not set the property during the Initialize method and set them during run time (both using the DataMember property and seting only the DataSource - without a DataMember)
2. Remove all code setting the DataMember propery
I don't understand why the ListChanged event is raised during the Initialize process but I also added a private variable to prevent this code from running until the control finished loading
It has been very difficult to fix this error because it seems to occur randomnly and I have no way of reproducing it on a consistent basis. If the application is restarted and the control is reopened (using the same data), the error will not come up again for some time.
I would sincerely appreciate any help to solve this issue as the application is in production and we have not been able to find a solution.