Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 1.36 KB

wpf-hang-when-resizing-a-grid.md

File metadata and controls

53 lines (37 loc) · 1.36 KB

Resizing a Grid can cause an application to become unresponsive

Scope

Edge

Version Introduced

4.7

Version Reverted

4.7.1

Source Analyzer Status

NotPlanned

Change Description

An infinite loop can occur during layout of a T:System.Windows.Controls.Grid under the following circumstances:

  • Row definitions contain two *-rows, both declaring a MinHeight and a MaxHeight.
  • Content of the *-rows doesn't exceed the corresponding MaxHeight
  • The Grid's available height is exceeded by the first MinHeight (plus any other fixed or Auto rows)
  • The app targets .NET Framework 4.7, or opts in to the 4.7 allocation algorithm by setting Switch.System.Windows.Controls.Grid.StarDefinitionsCanExceedAvailableSpace=false

The loop would also happen with more than two rows, or in the analogous case for columns.

The issue is fixed in .NET Framework 4.7.1.

  • Quirked
  • Build-time break

Recommended Action

Upgrade to .NET Framework 4.7.1. Alternatively, if you don't need the 4.7 allocation algorithm you can use the following configuration setting:

<runtime>
    <AppContextSwitchOverrides value="Switch.System.Windows.Controls.Grid.StarDefinitionsCanExceedAvailableSpace=true" />
</runtime>

Affected APIs

  • Not detectable via API analysis

Category

Windows Presentation Foundation (WPF)