Hi,
I have a strange Problem with UltraCombo and Databinding after installing .NET Framework 4.5.
My Project runs under Windows 7 (x86 and x64) on Visual Studio 2010, compiled for .NET Framework 4.5 with Infragistics 12.1 for .NET 4.
When I only install .NET 4.5 (what happens when I install Visual Studio 2012) I get the following Exception when setting an UltraCombos DataSource (either when debugging in Visual Studio and when running the compiled, deployed version).
bei Infragistics.Shared.KeyedSubObjectsCollectionBase.ValidateKeyDoesNotExist(String key, IKeyedSubObject ignoreObject) bei Infragistics.Shared.KeyedSubObjectsCollectionBase.ValidateKey(String key, IKeyedSubObject ignoreObject) bei Infragistics.Shared.KeyedSubObjectsCollectionBase.InternalAdd(IKeyedSubObject obj) bei Infragistics.Win.UltraWinGrid.ColumnsCollection.InternalAdd(UltraGridColumn column) bei Infragistics.Win.UltraWinGrid.UltraGridBand.InitColumns(UltraGridBand[] oldBands) bei Infragistics.Win.UltraWinGrid.UltraGridBand.InitListManager(BindingManagerBase bindingManager, String dataMember, UltraGridBand[] oldBands) bei Infragistics.Win.UltraWinGrid.UltraGridLayout.ListManagerUpdated(BindingManagerBase bindingManager) bei Infragistics.Win.UltraWinGrid.UltraGridLayout.ListManagerUpdated() bei Infragistics.Win.UltraWinGrid.UltraGridBase.Set_ListManager(Object newDataSource, String newDataMember) bei Infragistics.Win.UltraWinGrid.UltraGridBase.set_DataSource(Object value) bei GuiLayer.Implementation.Helper.UltraGridHelper.BindList[T](List`1 dataList, UltraDropDownBase dataControl, String displayMember, String valueMember)
When I add a new winform to my project, put there an UltraCombo an bind a List of business objects; that works! So the existing dialogs/ultracombos cause the exception, but new dialogs/ultracombos I can add without getting the exception.
After uninstalling .NET 4.5 it all works fine again.
I really cannot imagine what causes this exception. I hope you can help me with that.
Sorry to hear that you are running into an issue. I would like to take a look. I am from .NET Framework compatibility team.
Could you email me at netfx45compat at Microsoft dot com with code that I can use to reproduce the issue on my machine.
Regards,
Varun
Thanks for your reply,
but I already found the cause of the error.
The problem is, that I have an interface that inherits from another interface:
public interface IItem { /// <summary> /// Gets/sets the item's database id /// </summary> Guid Id { get; set; }
/// <summary> /// Gets/sets, if the item is a new item and is not yet saved /// </summary> bool IsNewItem { get; set; } bool IsModifiable { get; set; } bool IsDeletable { get; set; } } public interface IOrga : IItem { /// <summary> /// Gets/sets the Organisation's database id /// </summary> new Guid Id { get; set; }
/// <summary> /// Gets/sets the organisation's short name /// </summary> string Shortname { get; set; } string Description { get; set; } }
Here is my statement for binding my datasource:
UltraCombo myCombobox = new UltraCombo();List<IOrga> myOrgas = new List<IOrga>();myOrgas = GetMyOrgas();myCombobox.DataSource = myOrgas;myCombobox.ValueMember = "Id";myCombobox.DisplayMember = "Shortname";
With .NET 4, the ultracombo generates columns only for IOrga's properties ( Id, Shortname, Description ), so I need here the property Id to define "Id" as the ultracombo's valuemember.With the new .NET 4.5 the ultracombo generates columns for the IOrga properties AND for the IItem properties. And because both have the property id, the ultracombo tries to generate two columns with the key "Id" which leads to my posted exception.
So my guess is in .NET 4.5 the method you are using to get the objects properties is changed, so that all properties among the inheritance hierarchy is returned. Can you hange that behaviour in your controls or do i have to change my code?
Kind regards,Martin