Skip to content

[Android] Fix crash in GraphicsView when using TapGestureRecognizer#34301

Merged
PureWeen merged 2 commits intodotnet:mainfrom
jpd21122012:fix/34296-GraphicsView-TapGesture
Mar 5, 2026
Merged

[Android] Fix crash in GraphicsView when using TapGestureRecognizer#34301
PureWeen merged 2 commits intodotnet:mainfrom
jpd21122012:fix/34296-GraphicsView-TapGesture

Conversation

@jpd21122012
Copy link
Copy Markdown
Contributor

Description of Change

Fixes a crash on Android when using TapGestureRecognizer with GraphicsView.

Root Cause

PlatformTouchGraphicsView.TouchesMoved assumed that _lastMovedViewPoints
always contained at least one element.

In certain touch event sequences (triggered when a TapGestureRecognizer is attached),
_lastMovedViewPoints could be empty while points.Length == 1,
leading to an IndexOutOfRangeException.

Fix

Added a length check before accessing _lastMovedViewPoints[0]
to prevent out-of-range access.

Verified Scenarios

  • TapGestureRecognizer no longer causes a crash
  • Tap events fire correctly
  • Drag interaction remains functional
  • Multitouch does not crash

Fixes #34296

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 2, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34301

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 34301"

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Mar 2, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

@PureWeen
Copy link
Copy Markdown
Member

PureWeen commented Mar 3, 2026

/azp run maui-pr-uitests, maui-pr-devicetests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

@PureWeen
Copy link
Copy Markdown
Member

PureWeen commented Mar 4, 2026

/azp run maui-pr-uitests, maui-pr-devicetests

@PureWeen PureWeen added this to the .NET 10 SR5 milestone Mar 4, 2026
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community ✨ Community Contribution

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

TapGestureRecognizer on GraphicsView causes a crash on Android devices

4 participants