Skip to content

Conversation

@devanathan-vaithiyanathan
Copy link
Contributor

@devanathan-vaithiyanathan devanathan-vaithiyanathan commented Oct 1, 2025

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!

Issue Details

DisplayPrompt/DisplayAlert/DisplayActionSheet don't display when called in new page constructor or OnAppearing.

Description of Change

The fix ensures alerts, action sheets, and prompts are only executed when the view’s Handler is ready. If the handler is not yet set, the action is deferred using the HandlerChanged event, so the UI request executes once the view is fully initialized. This ensures dialogs appear reliably on Android platform platforms

Issues Fixed

Fixes #25585

Tested the behavior in the following platforms.

  • Android
  • Windows
  • iOS
  • Mac

Output Screenshot

Before After
Android
Before.mov
Android
After.mov

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

Hey there @@devanathan-vaithiyanathan! 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 Oct 1, 2025
@devanathan-vaithiyanathan devanathan-vaithiyanathan marked this pull request as ready for review October 2, 2025 06:57
Copilot AI review requested due to automatic review settings October 2, 2025 06:57
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 an issue where DisplayAlert, DisplayActionSheet, and DisplayPrompt would not appear when called from a new page's constructor or OnAppearing method on Android, causing the app to become unresponsive.

Key changes:

  • Added handler readiness checks before executing dialog requests
  • Implemented deferred execution using HandlerChanged event when handler is not ready
  • Added comprehensive UI tests to validate the fix

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/Controls/src/Core/Platform/AlertManager/AlertManager.Android.cs Implements the core fix by adding handler readiness checks and deferred execution logic for alert, action sheet, and prompt requests
src/Controls/tests/TestCases.HostApp/Issues/Issue25585.cs Creates the UI test page that reproduces the issue by calling DisplayAlert from a page constructor
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25585.cs Implements the automated test that verifies the dialog appears correctly after navigating to a new page

new Label { Text = "If DisplayAlert is shown, the test passed" },
}
};
DisplayAlert("Hi", "This is from Constructor", "OK", "Cancel");
Copy link

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

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

The test case only validates DisplayAlert from the constructor. Consider adding test coverage for DisplayActionSheet and DisplayPrompt as well, since the fix addresses all three dialog types and they may have different behavior patterns.

Copilot uses AI. Check for mistakes.
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

editText.RequestFocus();
}

bool WaitForHandlerIfNeeded(IView sender, System.Action action)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be a public extension method useful for developers.

@PureWeen PureWeen changed the base branch from main to inflight/current October 9, 2025 21:50
@PureWeen PureWeen merged commit 6bfa4f9 into dotnet:inflight/current Oct 9, 2025
128 of 130 checks passed
PureWeen pushed a commit that referenced this pull request Oct 30, 2025
#31838)

* Update AlertManager.Android.cs

* Update AlertManager.Android.cs

* Update AlertManager.Android.cs

* Update AlertManager.Android.cs

* Test case added

* Update Issue25585.cs

* Update Issue25585.cs

* Update AlertManager.Android.cs

* Update AlertManager.Android.cs

* Curly braces added

* unused namespace removed
github-actions bot pushed a commit that referenced this pull request Nov 4, 2025
#31838)

* Update AlertManager.Android.cs

* Update AlertManager.Android.cs

* Update AlertManager.Android.cs

* Update AlertManager.Android.cs

* Test case added

* Update Issue25585.cs

* Update Issue25585.cs

* Update AlertManager.Android.cs

* Update AlertManager.Android.cs

* Curly braces added

* unused namespace removed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-dialogalert DisplayAlert, dialog community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

App Unresponsive when prompting the user from a new page

4 participants