Add ModalDismissAttempted event for cancellable iOS modal dismissals#2
Closed
Add ModalDismissAttempted event for cancellable iOS modal dismissals#2
Conversation
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
…et#6995 Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
…lation Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
…pted Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix garbage collection issues in MAUI
Add ModalDismissAttempted event for cancellable iOS modal dismissals
Dec 19, 2025
PureWeen
pushed a commit
that referenced
this pull request
Mar 9, 2026
…tnet#33071) App crashes because of changing a shared Drawable on the fly. I found out it is the SearchBar. It only happens on Android and in large apps with lots of screens. Unfortunately I can't reproduce it in the TestSuite. But by reading the docs of Android this crash is common and caused by changing a Drawable which is still referenced. With a custom SearchBarHandler the issues is resolved. ```Backtrace (top frames): #00 pc 00000000006b8694 /system/lib64/libhwui.so android::getRootAlpha(_JNIEnv*, _jobject*, long) +4 #1 pc 0000000002256c90 /memfd:jit-cache (deleted) art_jni_trampoline +112 #2 pc 000000000223bc4c /memfd:jit-cache (deleted) android.graphics.drawable.VectorDrawable.-$$Nest$smnGetRootAlpha +108 #3 pc 000000000223bb20 /memfd:jit-cache (deleted) android.graphics.drawable.VectorDrawable$VectorDrawableState.getAlpha +144 #4 pc 00000000025c50e0 /memfd:jit-cache (deleted) android.graphics.drawable.VectorDrawable.getAlpha +128 #5 pc 00000000025c4f9c /memfd:jit-cache (deleted) android.graphics.drawable.VectorDrawable.getOpacity +124 #6 pc 00000000025c1ea8 /memfd:jit-cache (deleted) android.widget.ImageView.isOpaque +152 #7 pc 000000000227979c /memfd:jit-cache (deleted) android.view.View.invalidateInternal +428 #8 pc 00000000025c4790 /memfd:jit-cache (deleted) android.widget.ImageView.invalidateDrawable +256 #9 pc 000000000224419c /memfd:jit-cache (deleted) android.graphics.drawable.Drawable.invalidateSelf +156 #10 pc 000000000260e710 /memfd:jit-cache (deleted) android.graphics.drawable.VectorDrawable.setTintList +192 #11 pc 00000000025d0094 /memfd:jit-cache (deleted) **android.graphics.drawable.Drawable.setTint +148** ``` ### Description of Change - Changes tinting of Androids SearchBar to unified setTint instead of setColorFilter - Mutates the drawable before setting the tint. ### Issues Fixed Issue is fixed with a custom handler for now. Fixes dotnet#33070
PureWeen
added a commit
that referenced
this pull request
Mar 9, 2026
…es (dotnet#33963) <!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Description Adds rule #2 to the Git Workflow section in copilot-instructions.md: **When fixing CI or amending an existing PR, commit directly to the PR branch.** Do not create a separate branch off a PR branch — the PR branch already IS a feature branch. Creating a new branch means CI will not run on the PR, defeating the purpose. Also adds a code example showing the correct workflow (`gh pr checkout` → commit → push). ## Motivation Copilot CLI was incorrectly creating separate branches when asked to fix CI on existing PRs, because rule #1 ("never commit to main, create a feature branch") was being over-generalized to PR branches. This caused wasted time since CI only runs on PR branches. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
iOS 13+ allows users to dismiss FormSheet/PageSheet modals by swiping down, but MAUI had no mechanism for developers to intercept or cancel these dismissals. This adds the necessary wiring to
UIAdaptivePresentationControllerDelegatemethods.Changes
Page.ModalDismissAttemptedevent withModalDismissAttemptedEventArgscontaining aCancelpropertypresentationControllerShouldDismiss:inControlsModalWrapperto raise the event and respect the cancellationUsage
The event fires when the user swipes down or taps outside the modal. Setting
Cancel = trueprevents iOS from dismissing the modal. Works on iOS/MacCatalyst 13+; event exists but is not triggered on other platforms.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
4zjvsblobprodcus390.vsblob.vsassets.io/home/REDACTED/work/maui/maui/.dotnet/dotnet dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -t:UpdateDesignTimeXaml(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.