Skip to content

Replace deprecated Page.DisplayAlert with Shell.Current.DisplayAlert in MAUI sample#4320

Merged
glennawatson merged 2 commits intocleanup/remove-old-integration-testsfrom
copilot/fix-deprecated-api-call
Apr 2, 2026
Merged

Replace deprecated Page.DisplayAlert with Shell.Current.DisplayAlert in MAUI sample#4320
glennawatson merged 2 commits intocleanup/remove-old-integration-testsfrom
copilot/fix-deprecated-api-call

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

Page.DisplayAlert is marked obsolete in MAUI 10. The MAUI sample's LoginPage was calling the instance method directly instead of routing through Shell.Current.

Changes

  • src/examples/ReactiveUI.Samples.Maui/LoginPage.xaml.cs: Replace await DisplayAlert(...) with await (Shell.Current?.DisplayAlert(...) ?? Task.CompletedTask), using the null-conditional to guard against Shell.Current being null at call time.
// Before
await DisplayAlert(
    success ? "Login Successful" : "Login Failed",
    success ? "Welcome!" : "Invalid credentials.",
    "OK")

// After
await (Shell.Current?.DisplayAlert(
    success ? "Login Successful" : "Login Failed",
    success ? "Welcome!" : "Invalid credentials.",
    "OK") ?? Task.CompletedTask)

Agent-Logs-Url: https://github.com/reactiveui/ReactiveUI/sessions/6ba4073e-9c47-41d8-9caf-abe1e86fd740

Co-authored-by: glennawatson <5834289+glennawatson@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix deprecated API call in comments Replace deprecated Page.DisplayAlert with Shell.Current.DisplayAlert in MAUI sample Apr 2, 2026
Copilot AI requested a review from glennawatson April 2, 2026 11:36
@glennawatson glennawatson marked this pull request as ready for review April 2, 2026 11:38
@glennawatson glennawatson merged commit e652b7e into cleanup/remove-old-integration-tests Apr 2, 2026
@glennawatson glennawatson deleted the copilot/fix-deprecated-api-call branch April 2, 2026 11:38
glennawatson pushed a commit that referenced this pull request Apr 3, 2026
@github-actions
Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants