Skip to content

.NET 4.7.1 Grid star sizing causes hang in ResolveStarMaxDiscrepancy #604

@brinko99

Description

@brinko99

I'm seeing another Grid hanging issue in 4.7.1 regarding WPF Grid star sizing column widths.

Specifically ResolveStarMaxDiscrepancy seems to hang or get into some sort of infinite loop under certain conditions. The below Window reproduces the problem; slowly reduce the width of the Window until Column 2 reaches a width of 200 and the application hangs.

@SamBent, you suggest here that a similar issue was resolved in 4.7.1. The workaround mentioned (StarDefinitionsCanExceedAvailableSpace=true) does work around this issue as well.

Breaking the application shows the main thread sitting at: PresentationFramework.dll!System.Windows.Controls.Grid.ResolveStarMaxDiscrepancy(System.Windows.Controls.DefinitionBase[] definitions, double availableSize)

<Window x:Class="GridMinWidthRepo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Height="200" Width="500">
    <Grid Margin="0,20,0,0">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="100" />
            <ColumnDefinition Width="*" MaxWidth="20" />
            <ColumnDefinition Width="*" MinWidth="200" />
        </Grid.ColumnDefinitions>
        <TextBox Grid.Column="0" HorizontalAlignment="Stretch" />
        <TextBox Grid.Column="2" HorizontalAlignment="Stretch"
                 Text="{Binding RelativeSource={RelativeSource Self}, Path=ActualWidth, Mode=OneWay}"/>
    </Grid>
</Window>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions