Skip to content

Incorrect Paramaters caused crush in demo code. #4172

@hyprocritor

Description

@hyprocritor

Problem

In the below demo code:

RightPaddingColumn.Width = new GridLength(appWindow.TitleBar.RightInset / scaleAdjustment);

app Window.TitleBar.RightInset may return a negative integer, which will lead to the program being crushed.

Reproduce:

Fast minimizing and restoring the window (for example: clicking the program in the taskbar) will reproduce the issue.

Possible fix:

I used Math.abs to filter appWindow.TitleBar.RightInset / scaleAdjustment works. The program does not crush anymore. May not a correct fix for this problem.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions