FIX: ArgumentOutOfRangeException exception when you resize or scroll a window that has a DataGrid control in a .NET Framework 4.0-based WPF application

Article translations Article translations
Article ID: 2484832 - View products that this article applies to.
Expand all | Collapse all

On This Page

SYMPTOMS

Consider the following scenario:
  • You run a Microsoft .NET Framework 4.0-based Windows Presentation Foundation (WPF) application. 
  • The WPF application has a window that contains a DataGrid control. The EnableColumnVirtualization property of the DataGrid control is set to True.
  • You resize this window. Or, you move the scroll bar of this window.
In this scenario, the application may encounter an ArgumentOutOfRangeException exception, and then the WPF application may crash. Additionally, you may receive the following error message:
Index was out of range. Must be non-negative and less than the size of the collection.

CAUSE

This issue occurs because some rows of the DataGrid control are virtualized while a set of devirtualized columns are changed. After the rows are virtualized, some invalid information is generated for the rows. When this information is used to create an array index and to display the rows, an exception is encountered.

RESOLUTION

Hotfix information

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

To resolve this problem immediately, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:
http://support.microsoft.com/contactus/?ws=support
Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Prerequisites

To apply this hotfix, you must have the Microsoft .NET Framework 4.0 installed.

Restart requirement

You may have to restart the computer after you apply this hotfix.

We recommend that you close all .NET Framework applications that lock or use the affected files before you install this hotfix.

Hotfix replacement information

This hotfix does not replace any other hotfix.

File Information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.

For all supported x86-based versions of Windows XP, of Windows Server 2003, of Windows Vista, of Windows Server 2008, and of Windows 7
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Presentationcore.dll4.0.30319.4183,546,46411-Jan-201106:42x86
Presentationframework.dll4.0.30319.4186,347,62411-Jan-201106:42x86
Windowsbase.dll4.0.30319.4181,304,92011-Jan-201106:42x86
For all supported x64-based versions of Windows XP, of Windows Server 2003, of Windows Vista, of Windows Server 2008, of Windows 7, and Windows Server 2008 R2
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Presentationcore.dll4.0.30319.4183,454,30411-Jan-201107:26x64
Presentationframework.dll4.0.30319.4186,347,62411-Jan-201106:42x86
Windowsbase.dll4.0.30319.4181,304,92011-Jan-201106:42x86

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Call stack information

   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at System.Collections.Generic.List`1.System.Collections.IList.get_Item(Int32 index)
   at System.Windows.Controls.DataGridCellsPanel.ArrangeOverride(Size arrangeSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at MS.Internal.Helper.ArrangeElementWithSingleChild(UIElement element, Size arrangeSize)
   at System.Windows.Controls.ItemsPresenter.ArrangeOverride(Size arrangeSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.Control.ArrangeOverride(Size arrangeBounds)
   at System.Windows.Controls.Primitives.DataGridCellsPresenter.ArrangeOverride(Size finalSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.Grid.ArrangeOverride(Size arrangeSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.Border.ArrangeOverride(Size finalSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.Control.ArrangeOverride(Size arrangeBounds)
   at System.Windows.Controls.DataGridRow.ArrangeOverride(Size arrangeBounds)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.VirtualizingStackPanel.ArrangeOverride(Size arrangeSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at MS.Internal.Helper.ArrangeElementWithSingleChild(UIElement element, Size arrangeSize)
   at System.Windows.Controls.ItemsPresenter.ArrangeOverride(Size arrangeSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)

Properties

Article ID: 2484832 - Last Review: January 31, 2011 - Revision: 1.0
APPLIES TO
  • Microsoft .NET Framework 4
Keywords: 
kbqfe kbhotfixserver kbfix kbexpertiseadvanced kbsurveynew KB2484832

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com