i have just upgraded my computer to a Sony all in one PC and i have installed all the software i use,, but when it comes to running my application which uses infragistics controls via deployment and via Debugging environment the app crashes as soon as it has to load data into a XamDataGrid with the following error:
Argument Exception was unhandled
Item has already been added. Key in dictionary: 'Infragistics.Windows.Automation.Peers.DataPresenter.CellAutomationPeer' Key being added: 'Infragistics.Windows.Automation.Peers.DataPresenter.CellAutomationPeer'
I have tried tracking down the error but to no avail so any assistance will be greatly appreciated.
The Computer is running Windows 7 Professional 64bit and im using NetAdvantage WPF 2010.3
The issue should be addressed in the latest hotfix (available back in August). You can get the download by going to My Infragistics => Keys and Downloads.
I have tried installing the WPF 2250 Service Release but error still persists
The issue only came about/surfaced when MS made some optimizations (fixes?) to the automation handling recently so we addressed the issue in all the versions still in maintenance/development at the time so 10.1 and forward. Sorry for any inconvenience but older versions were no longer being maintained at the time that the issue started.
We are not in a position right now to upgrade to a newer release based on the QA resources that we have to cover the testing needed. So, is there something that we can do on our end to fix this issue without upgrading? Or, I think we have XamDataGrid's source code, so can you tell me what changes to make in the source code to fix this bug?
Andrew, Can you provide us the event that the problem is generated from? We would like to suppress the exception in that event,
There is no specific event that is related. Essentially the problem in the AutomationPeer was always there but because MS wasn't caching the peer state it didn't result in an issue but when MS made a change recently and fixed the caching it caused this issue to surface. In our code the issue was fixed by making a change in the AutomationPeerProxy's GetChildrenCore implementation. Specifically to have it create a new List<AutomationPeer> constructed using the result of the call to peer.GetChildren.
Thanks for the reply Andrew. As we posted already, we are not in a position to upgrade to latest infragistics version because of wide reaction in our product. This issue is particualrly observed when application is running in recording tools like Morae.
We have a scenario where IG grid is added as WPF Combobox item used for lookup . This cutom control is been used widely in our product in key places.The above exception is seen when we try to scroll or select the records in the combo box item grid while the recording tool is running. Our usability study team is unable to proceed further because of this issue.
If you can help us to point any particular event like ItemSelected or RecordsInViewChanged where we can handle above exception and allow application to continue that would be great.
The workaround that Andrew suggested should work as long as it is done for a ancestor of the XamDataGrid. One scenario that I can think of where this may fail is if you are to use the workaround on the Window and within that Window use a XamDockManager with the XamDataGrid in a ContentPane. If the pane containing the XamDataGrid were to be floated then the XamDataGrid would no longer be a descendant of the Window so the workaround wouldn't have any affect. If this is the case, you would need to move the workaround to a container around the grid within the ContentPane such as a UserControl.
OK, settings at the solution level overridden confguration settings at project level. I'm doing the whole recompilation with solution level release settings. will update you for any issues after that.thanks
Andrew, I debugged the code and verified that these assert statements are poping up now and then.
for example Debug.Assert(adjustedScrollPosOfTargetRecord >= 0); is rasing while editing the records. I indeed built the binaries in release mode but the binaries are not dropping at bin/Release instead they always drop in bin/Debug mode. I'm not sure if some other settings are overriding. Can you help us to build the binaries in release mode and if I'm missing something?
Thanks.
I have never seen that assert being raised so I cannot say what is happening. If you want us to look into that you would need to supply a sample that reproduces the issue. Basically the only assert in that routine is veritying that we have exited edit mode (or more accurately that we don't still have a CVP for a cell in edit mode which would/should have been cleared when the cell exited edit mode unless there was a problem there or unless someone tried to force the cell back into edit mode likely on another cell). That may well have been happening in your real application without you knowing since you would only see the assert if you were using a debug build - which you weren't with the release version.
I'm not sure what you are asking. If you are asking about when GetChildrenCore will be invoked as I mentioned I do not know as that is not something that we control. It is controlled/invoked by the WPF framework when something wants to get the children for a given automation peer or possibly when the associated element has been invalidated to update the cache. For anything further on that method you would have to check with MS or use reflector to review the WPF framework's implementation.
As to the OnSorted that is used to raise the Sorted event and from your description I do not know what is the cause of the NRE - it could be within your handling of the Sorted event or something else.