After installing .NET 4.5, our existing code that currently runs on .NET 4.0 is throwing exceptions when assigning data source to DataGridView (note that it was working fine before .NET 4.5, and continues to work when 4.5 is uninstalled... but for several reasons we have to have .NET 4.5 on clients computers):
dgrManagers.DataSource = mManagers;
//where mManagers is System.Collections.ObjectModel.ObservableCollection<IManager>; the collection has 0 items.
//and dgrManagers is an instance of class that extends from Infragistics UltraGrid (Infragistics.Win.UltraWinGrid.v5.2.dll, v5.2.20052.1053).
//Extending is for style purposes, no grid content is referenced.
Previous to this, the grid was initialized (once) with:
foreach (UltraGridColumn c in dgrManagers.DisplayLayout.Bands[0].Columns) { switch (c.Key) { case "FullName": c.Header.Caption = "Full name"; c.Header.VisiblePosition = 0; c.Width = dgrManagers.Width - 30; break; default: c.Hidden = true; break; } } dgrManagers.HasLayout = true;
Errors specifics:
HResult: -2147024809
Assemlby: {Infragistics.Shared.v5.2, Version=5.2.20052.1053, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb}
Key already exists Parameter name: Key
at Infragistics.Shared.KeyedSubObjectsCollectionBase.ValidateKeyDoesNotExist(String key, IKeyedSubObject ignoreObject) at Infragistics.Shared.KeyedSubObjectsCollectionBase.ValidateKey(String key, IKeyedSubObject ignoreObject) at Infragistics.Shared.KeyedSubObjectsCollectionBase.ValidateKey(String key) at Infragistics.Shared.KeyedSubObjectsCollectionBase.InternalAdd(IKeyedSubObject obj) at Infragistics.Win.UltraWinGrid.ColumnsCollection.InternalAdd(UltraGridColumn column) at Infragistics.Win.UltraWinGrid.UltraGridBand.InitColumns(UltraGridBand[] oldBands) at Infragistics.Win.UltraWinGrid.UltraGridBand.InitListManager(BindingManagerBase bindingManager, String dataMember, UltraGridBand[] oldBands) at Infragistics.Win.UltraWinGrid.UltraGridLayout.ListManagerUpdated(BindingManagerBase bindingManager) at Infragistics.Win.UltraWinGrid.UltraGridLayout.ListManagerUpdated() at Infragistics.Win.UltraWinGrid.UltraGridBase.Set_ListManager(Object newDataSource, String newDataMember) at Infragistics.Win.UltraWinGrid.UltraGridBase.set_DataSource(Object value)
I understand this is an old version of Infragistics, but we're not ready to switch to new one (even though we have some newer licences) since the project is quite huge and has been working for quite some time, and I'm afraid it would cause even more errors if the new version is not fully backward compatible.
Does anyone have any idea how to circumvent this problem? Any help/hint is appreciated...
Thanks,
Veljko
So far, I've been able to pinpoint the problem. The IManager extends from some other interface that has the same properties, e.g.:
public interface IIdentifyable{
string Identifier{get;set;}
}
public interface IManager : IIdentifyable{
string Identifier{get;set;} //should be with "new" in front to hide inherited member, but it breaks anyway
string FirstName {get;set;}
string LastName {get;set;}
When this is bound to UltraGrid, it throws exception, saying it has duplicate keys. When I remove inheritance from IManager to IIdentifyable, everything works. I'm guessing it's using reflection to get to column keys, but this:
foreach(var prop in typeof(IManager).GetProperties())
Console.WriteLine("Prop name = " + prop.Name);
doesn't output any duplicates. So how is it that the UltraGrid is getting the column names/keys based on object type?
Hi,
You are probably right. Microsoft made some changes in CLR4 and we had to change around certain interfaces we were using in the WinGrid and some other assemblies that deal with data binding.
These issues are fixed in the latest version of NetAdvantage.
NetAdvantage 2005 is, of course, not supported in DotNet CLR4, since that version of NetAdvantage was retired years before CLR4 was release.
So, basically, if this is to work, either we change inheritance tree of all objects in use, or change the version of NetAdvantage...
Since changing the version seems like a lot less effort, can you estimate if the NetAdvantage 8.2 would work with this scenario? I believe this is the latest version we bought our license for...
Hello Veljko,
I am checking about the progress of this issue. Please let me know If you need any further assistance on this.
It's a bit complicated to experiment with this since I first have to install .NET 4.5, break our base classes that inherit the Infragistics, compile everything back and test every app that's using our base dll's ... I'll let you know if I manage to handle this, but so far, I'll mark this as answered since there's no further info that can help...
Thanks for your replies!
Dear all
We encounter the same problem with Version 12.1.20121.2050, CLR4.
Should it be corrected on this version?
If not, when does the next service release arrive?
Thanks in advance
Urs Scherrer
Hello Everybody
We see the same error on version 12.1.20121.2050.
So, when will this be corrected? Should it be corrected already?
Kind Regards,