Skip to content

[Windows]Fixed the ViewExtensions RotateYTo and RotateXTo with length 0 crashes#30167

Merged
jfversluis merged 3 commits intodotnet:inflight/currentfrom
Ahamed-Ali:fix-18420-ArgumentException
Nov 27, 2025
Merged

[Windows]Fixed the ViewExtensions RotateYTo and RotateXTo with length 0 crashes#30167
jfversluis merged 3 commits intodotnet:inflight/currentfrom
Ahamed-Ali:fix-18420-ArgumentException

Conversation

@Ahamed-Ali
Copy link
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Root Cause of the issue

  • When RotateYTo is dynamically updated with a duration of 0, it causes the value calculation in Tweener class to result in NaN. This NaN value is then passed to the UpdatedTransformation method on Windows, where the subtraction between the PlaneProjection's Rotation property and the MAUI rotation leads to an ArgumentException.

https://github.com/dotnet/maui/blob/main/src/Controls/src/Core/Tweener.cs#L124

Description of Change

  • If the calculated value is NaN, a defensive check is added to prevent invalid transformations from being applied. This ensures that when any rotation value is NaN (Not a Number), it is skipped. On subsequent updates, a valid value will be used, allowing the transformation to proceed as expected.

Issues Fixed

Fixes #18420

Tested the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Screenshot

Before Issue Fix After Issue Fix
CrashOccured.mp4
NoCrashwithFix.mp4

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jun 24, 2025
@dotnet-policy-service
Copy link
Contributor

Hey there @@Ahamed-Ali! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jun 24, 2025
@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Ahamed-Ali Ahamed-Ali marked this pull request as ready for review June 25, 2025 08:01
@Ahamed-Ali Ahamed-Ali requested a review from a team as a code owner June 25, 2025 08:01
@Ahamed-Ali Ahamed-Ali requested review from PureWeen and rmarinho June 25, 2025 08:01
@Ahamed-Ali Ahamed-Ali force-pushed the fix-18420-ArgumentException branch from 9827682 to 7d19073 Compare September 23, 2025 04:36
Copilot AI review requested due to automatic review settings September 23, 2025 04:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a crash on Windows when ViewExtensions.RotateYTo and RotateXTo are called with a duration of 0, which resulted in NaN values being passed to the transformation system causing ArgumentExceptions.

  • Adds defensive NaN checks in the Windows transformation logic to prevent invalid transformations
  • Includes comprehensive UI tests to validate the fix across multiple button taps with zero-duration rotations
  • Fixes a variable reference issue in the transformation condition check

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/Core/src/Platform/Windows/TransformationExtensions.cs Adds NaN validation and fixes variable reference in rotation condition
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18420.cs NUnit test that verifies multiple zero-duration rotations don't crash
src/Controls/tests/TestCases.HostApp/Issues/Issue18420.cs Host app UI test page with button that triggers zero-duration RotateYTo calls

@jfversluis
Copy link
Member

/rebase

@github-actions github-actions bot force-pushed the fix-18420-ArgumentException branch from 7d19073 to 973954a Compare November 27, 2025 12:23
@jfversluis jfversluis changed the base branch from main to inflight/current November 27, 2025 14:04
@jfversluis jfversluis force-pushed the fix-18420-ArgumentException branch from 973954a to 9114787 Compare November 27, 2025 14:07
@jfversluis jfversluis merged commit 1b1d0a3 into dotnet:inflight/current Nov 27, 2025
1 check passed
@jfversluis jfversluis added this to the .NET 10.0 SR2 milestone Nov 27, 2025
PureWeen pushed a commit that referenced this pull request Dec 3, 2025
#30167)

Included the test sample and test case for the fix

Updated the changes
github-actions bot pushed a commit that referenced this pull request Dec 5, 2025
#30167)

Included the test sample and test case for the fix

Updated the changes
This was referenced Dec 18, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Dec 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows]ViewExtensions RotateYTo and RotateXTo with length 0 crashes on Windows

4 participants