Skip to content

DataGrid goes into Infinity Loop #3073

@filipwa84

Description

@filipwa84

Describe the bug

The DataGrid sometimes goes into an infinity loop. What triggers it is somewhat random and seems to depend on the screen resolution, the DPI settings and the width of the given DataGrid rows.

In this example - and on my computer - the application just hangs as soon as it starts if the DataGrid is in a StackPanel. However, putting it inside a Grid works. Testing the same code on a second computer with higher resolution and a DPI setting of 150, it crashes in both senarios.

Opening the Task Manager while it is haning one can see that there is a core is consistently running at 100%.

Importing the DataGrid source code into the project and hitting pause while it is haning, the code keeps coming back to DataGridRow.cs line 1967: element.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)).

Steps to Reproduce

Steps to reproduce the behavior:

  1. Clone https://github.com/filipwa84/DataGridInfinity.git
  2. Add the DataGrid project to the solution
  3. From MainPage.xaml uncomment the code inside the StackPanel marked as not working
  4. Debug, hit pause and set a break point in DataGridRow.cs on line 1967
  5. If it doesn't hang, try hit refresh, change the resolution, DPI settings or try on another computer...

Expected behavior

Should not go into an infinity loop

NuGet Package(s): 
Microsoft.Toolkit.Uwp.UI.Controls.DataGrid
Package Version(s): 
6.0

Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [x] May 2019 Update (18362)
- [ ] Insider Build (build number: )

App min and target version:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [x] May 2019 Update (18362)
- [ ] Insider Build (xxxxx)

Device form factor:
- [x] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio 
- [ ] 2017 (version: )
- [x] 2019 (version: ) 
- [ ] 2019 Preview (version: )

Metadata

Metadata

Assignees

Labels

DataGrid 🔠Issues on DataGrid controlbug 🐛An unexpected issue that highlights incorrect behavior

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions