Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[WPF] Fix FormsPanel MeasureOverride negative requested size #10653

Conversation

tessarolli
Copy link
Contributor

Description of Change

On WPF Platform, Element.Measure().Request(); sometimes return negative values (-1) on Width or Height. If that happened, instantiating a new Windows.Size with negative values would throw an exception that prevented software execution.
This fix is to prevent that from happening, as it checks and replaces -1 values with zero.

Issues Resolved

Fix Negative Width or Height on new Windows.Size();

API Changes

None

Platforms Affected

WPF

Behavioral/Visual Changes

None

Before/After Screenshots

Not applicable

PR Checklist

  • Targets the correct branch

@VladislavAntonyuk
Copy link
Contributor

Thank you for the PR. please make sure you didn't break fixes for:
#6436
#8039
#9029
#5682
#6842

@tessarolli
Copy link
Contributor Author

Hi Vladislav,

I've update to check for all negative values.

Personally, I dont believe it will break any of those fixes you mentioned, because in case you do receive a negative request size, it would throw an exception trying to instantiate a new Size(), that would prevent software execution.

I did some testings on my end and all seems fine.

@samhouts samhouts changed the base branch from master to 4.8.0 June 26, 2020 00:03
@samhouts samhouts changed the base branch from 4.8.0 to main July 30, 2020 00:04
@samhouts samhouts added this to In Review in vCurrent (4.8.0) Jul 30, 2020
@samhouts samhouts added this to In Review in .NET MAUI Backlog Jul 30, 2020
@samhouts samhouts removed this from In Review in vCurrent (4.8.0) Jul 30, 2020
@samhouts samhouts added t/bug 🐛 retarget-branch-required PR or associated issues target a milestone. Please target this PR to the matching branch. labels Aug 4, 2020
@samhouts samhouts added this to the 5.0.0 milestone Aug 4, 2020
@samhouts samhouts removed this from In Review in .NET MAUI Backlog Aug 4, 2020
@samhouts samhouts added this to In Review in vNext+1 (5.0.0) Aug 11, 2020
@samhouts samhouts changed the base branch from main to 5.0.0 September 3, 2020 00:01
@samhouts samhouts removed the retarget-branch-required PR or associated issues target a milestone. Please target this PR to the matching branch. label Sep 3, 2020
@samhouts samhouts merged commit c05e04d into xamarin:5.0.0 Sep 9, 2020
vNext+1 (5.0.0) automation moved this from In Review to Done Sep 9, 2020
@samhouts samhouts added this to Done in Sprint 176 Sep 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants