This is a migrated thread and some comments may be shown as answers.

ArgumentNullException in DataItemAutomationPeer

2 Answers 193 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Yvonne
Top achievements
Rank 1
Yvonne asked on 14 Jun 2011, 11:32 AM

Hy,

When moving our application window or resizing it then we get an ArgumentNullException in the DataItemAutomationPeer class.

We are currently on the binaries RadControls for WPF Q1 2011.
I looked at the currently available source code "01348RadControls_for_WPF_40_2011_1_0613_DEV_hotfix".

Callstack on Exception:
  Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.Automation.DataItemAutomationPeer.DataItemAutomationPeer(object dataItem, Telerik.Windows.Controls.GridView.Automation.GridViewDataControlAutomationPeer dataControlAutomationPeer) Line 78 C#
> Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.Automation.GridViewDataItemAutomationPeer.GridViewDataItemAutomationPeer(object dataItem, Telerik.Windows.Controls.GridView.Automation.GridViewDataControlAutomationPeer dataControlAutomationPeer) Line 25 C#
  Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.Automation.RadGridViewAutomationPeer.CreateDataItemAutomationPeer(object dataItem) Line 97 + 0x2f bytes C#
  Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.Automation.GridViewDataControlAutomationPeer.GeneratePeersForDataItems(System.Collections.Generic.List<System.Windows.Automation.Peers.AutomationPeer> newPeerList, Telerik.Windows.Controls.GridView.Automation.AutomationPeerStorage<object,Telerik.Windows.Controls.GridView.Automation.DataItemAutomationPeer> oldCachedPeers) Line 111 + 0x1c bytes C#
  Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.Automation.GridViewDataControlAutomationPeer.GetItemPeers() Line 101 C#
  Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.Automation.GridViewVirtualizingPanelAutomationPeer.GetChildrenCore() Line 79 + 0x21 bytes C#

What I saw in the source is:

In class GridViewDataControlAutomationPeer a check is done for (dataitem == null), see below:

        private void GeneratePeersForDataItems(List<AutomationPeer> newPeerList, AutomationPeerStorage<object, DataItemAutomationPeer> oldCachedPeers)
        {
            foreach (object dataItem in this.Items)
            {
                DataItemAutomationPeer dataItemPeer = oldCachedPeers.FindPeer(dataItem);

                if (dataItemPeer == null)
                    dataItemPeer = this.CreateDataItemAutomationPeer(dataItem);

                SetUpOwnerRowEventsSource(dataItemPeer);

                this.cachedPeers[dataItem] = dataItemPeer;
                newPeerList.Add(dataItemPeer);
            }
        }

Then later in the ctor of DataItemAutomationPeer I saw the following code:
        protected DataItemAutomationPeer(object dataItem, GridViewDataControlAutomationPeer dataControlAutomationPeer)
            : base(dataControlAutomationPeer.OwnerGridViewDataControl)
        {
            if (dataItem == null)
                throw new ArgumentNullException("dataItem");
            if (dataControlAutomationPeer == null)
                throw new ArgumentNullException("dataControlAutomationPeer");

            this.dataItem = dataItem;
            this.dataControlAutomationPeer = dataControlAutomationPeer;
        }

In my case I get the exception from this check in the ctor.

Kind regards,
Yvonne

2 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 16 Jun 2011, 05:08 PM
Hi Yvonne,

We have tried to reproduce this issue, but we have not faced any problems. Would you please provide us a simple example that successfully demonstrates this unwanted behavior, in order to help us provide better support to your case? Meanwhile, some information about your OS version will be highly appreciated. Thank you.

Greetings,
Ivan Ivanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Yvonne
Top achievements
Rank 1
answered on 28 Jun 2011, 09:01 AM
Hy,
This issue seems to be fixed with 2011 Q1 SP1.
Thanks
Tags
GridView
Asked by
Yvonne
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Yvonne
Top achievements
Rank 1
Share this question
or