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
Thanks for the quick reply. Now I'm able to see the exception even if recording tool is not running. Can you please give us any clue by looking at below stack trace? I'm getting below exception when with a simple test application.
at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) at System.Windows.Automation.Peers.AutomationPeer.UpdateChildren() at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() at System.Windows.ContextLayoutManager.fireAutomationEvents() at System.Windows.ContextLayoutManager.UpdateLayout() at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg) at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.TranslateAndDispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Application.RunInternal(Window window) at MultiSelectDropdown.App.Main() in E:\NEWTFS\Main\Common\Source\CommonControls\Samples\MultiSelectDropdown\MultiSelectDropdown\obj\Debug\App.g.cs:line 0 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
I'm sorry but there really is no information I can provide other than what I have. If you cannot upgrade and you have access to the source then you can make the change that I mentioned and use your own build of the assemblies.
The only other thing that I can think of is if you can live without automation support then you could override the OnCreateAutomationPeer in your window class or something above the xamDataGrid and return a derived automation peer of the peer class that element would use and override it's GetChildrenCore and return no children. This would of course mean that the grid would be invisible to any automation/accessibility client which could include your recording app, test platforms, etc. If you want to go this route then it might look something like:
public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } protected override System.Windows.Automation.Peers.AutomationPeer OnCreateAutomationPeer() { return new CustomWindowAutomationPeer(this); } } public class CustomWindowAutomationPeer : System.Windows.Automation.Peers.WindowAutomationPeer { public CustomWindowAutomationPeer(Window owner) : base(owner) { } protected override List<System.Windows.Automation.Peers.AutomationPeer> GetChildrenCore() { return new List<System.Windows.Automation.Peers.AutomationPeer>(); } }
protected override System.Windows.Automation.Peers.AutomationPeer OnCreateAutomationPeer() { return new CustomWindowAutomationPeer(this); } }
public class CustomWindowAutomationPeer : System.Windows.Automation.Peers.WindowAutomationPeer { public CustomWindowAutomationPeer(Window owner) : base(owner) { }
protected override List<System.Windows.Automation.Peers.AutomationPeer> GetChildrenCore() { return new List<System.Windows.Automation.Peers.AutomationPeer>(); } }
Thanks Andrew !!. Will try this work around and see if it works for us.
Andrew, just to let you know that the issue is seen when Google Desktop process is running. When I kill Google Desktop process, the issue is resolved. I was able to reproduce this consistently when Google desktop running.
And the work around you provided for window is not working for me. Our customers are reporting same issue and it seems they are not running any other processes. Just wanted to check if you get any clue out of this information
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.