Fix Glide IllegalArgumentException in PlatformInterop for destroyed activities#33805
Merged
PureWeen merged 7 commits intoinflight/currentfrom Feb 2, 2026
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix IllegalArgumentException for destroyed activity in Glide
Fix Glide IllegalArgumentException in PlatformInterop for destroyed activities
Jan 30, 2026
…ctivities Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
564cc2e to
22e5e43
Compare
Comment on lines
+725
to
+758
| /** | ||
| * Checks if the provided context's underlying Activity is destroyed or finishing. | ||
| * This is used to prevent Glide crashes when attempting to load images after activity destruction. | ||
| * @param context The context to check | ||
| * @return true if the context is destroyed, false otherwise | ||
| */ | ||
| private static boolean isContextDestroyed(Context context) { | ||
| Activity activity = getActivity(context); | ||
| if (activity != null) { | ||
| if (activity.isFinishing() || activity.isDestroyed()) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| /** | ||
| * Extracts the Activity from a Context, handling ContextWrapper chains. | ||
| * @param context The context to extract the Activity from | ||
| * @return The Activity if found, null otherwise | ||
| */ | ||
| private static Activity getActivity(Context context) { | ||
| if (context == null) { | ||
| return null; | ||
| } | ||
| if (context instanceof Activity) { | ||
| return (Activity) context; | ||
| } | ||
| if (context instanceof ContextWrapper) { | ||
| Context baseContext = ((ContextWrapper) context).getBaseContext(); | ||
| return getActivity(baseContext); | ||
| } | ||
| return null; | ||
| } |
Member
Contributor
Author
There was a problem hiding this comment.
Updated in 017b261. Changed isContextDestroyed to public static in MauiCustomTarget and updated PlatformInterop to call MauiCustomTarget.isContextDestroyed() instead of having duplicate methods.
…icating Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
src/Core/AndroidNative/maui/src/main/java/com/microsoft/maui/glide/MauiCustomTarget.java
Outdated
Show resolved
Hide resolved
…Target call it Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
jonathanpeppers
approved these changes
Feb 2, 2026
Member
jonathanpeppers
left a comment
There was a problem hiding this comment.
@PureWeen this looks reasonable to me for inflight if the CI is green enough.
Member
|
/azp run maui-pr-uitests, maui-pr-devicetests |
|
Azure Pipelines successfully started running 2 pipeline(s). |
PureWeen
pushed a commit
that referenced
this pull request
Feb 2, 2026
…ctivities (#33805) - [x] Analyze the issue and understand the crash from stack trace - [x] Review PR #29780 fix pattern for destroyed activity context check - [x] Add context destruction check in `PlatformInterop.loadImageFromFont(Context...)` method - [x] Add context destruction check in other `PlatformInterop` methods that use `Glide.with(context)`: - [x] `loadImageFromFile(Context...)` - [x] `loadImageFromUri(Context...)` - [x] `loadImageFromStream(Context...)` - [x] Verify changes compile successfully - [x] Move `isContextDestroyed` and `getActivity` methods to `PlatformInterop` and have `MauiCustomTarget` call them - [x] Run code review - [x] Run CodeQL security scan - [x] Final verification <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> ---- *This section details on the original issue you should resolve* <issue_title>java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity - glide</issue_title> <issue_description>### Description Random issue that I can not reproduce but happening on a small subset of devices according to firebase I believe a previously closed issue maybe the same thing happening: #17549 ### Steps to Reproduce No enough information to say at this point. ### Link to public reproduction project repository _No response_ ### Version with bug 9.0.70 SR7 ### Is this a regression from previous behavior? Yes, this used to work in .NET MAUI ### Last version that worked well 7.0.92 ### Affected platforms Android ### Affected platform versions Android 14 and up ### Did you find any workaround? No ### Relevant log output ```shell Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{######/crc641b109f8ad35faaaf.MainActivity}: java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4206) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) Caused by java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed(RequestManagerRetriever.java:236) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:110) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:92) at com.bumptech.glide.Glide.with(Glide.java:545) at com.microsoft.maui.PlatformInterop.loadImageFromFont(PlatformInterop.java:394) at crc641b109f8ad35faaaf.MainActivity.n_onCreate(MainActivity.java) at crc641b109f8ad35faaaf.MainActivity.onCreate(MainActivity.java:63) at android.app.Activity.performCreate(Activity.java:9079) at android.app.Activity.performCreate(Activity.java:9057) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1531) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4188) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) ```</issue_description> <agent_instructions>Looking at the stack trace above, it looks like the problem started in `loadImageFromFont()`. This PR: * #29780 Fixes the `clear()` code path, can we apply this to the stack trace on this issue?</agent_instructions> ## Comments on the Issue (you are @copilot in this section) <comments> <comment_new><author>@NafeelaNazhir</author><body> This issue has been verified in Visual Studio Code 1.100.2 with MAUI versions (9.0.70, 9.0.60, 9.0.50, 9.0.0). It cannot be reproduced on the Android(14.0+) platform. Is there any specific configuration needed for replicate the issue? https://github.com/user-attachments/assets/2... </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #29699 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/dotnet/maui/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
This was referenced Feb 2, 2026
Open
github-actions bot
pushed a commit
that referenced
this pull request
Feb 4, 2026
…ctivities (#33805) - [x] Analyze the issue and understand the crash from stack trace - [x] Review PR #29780 fix pattern for destroyed activity context check - [x] Add context destruction check in `PlatformInterop.loadImageFromFont(Context...)` method - [x] Add context destruction check in other `PlatformInterop` methods that use `Glide.with(context)`: - [x] `loadImageFromFile(Context...)` - [x] `loadImageFromUri(Context...)` - [x] `loadImageFromStream(Context...)` - [x] Verify changes compile successfully - [x] Move `isContextDestroyed` and `getActivity` methods to `PlatformInterop` and have `MauiCustomTarget` call them - [x] Run code review - [x] Run CodeQL security scan - [x] Final verification <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> ---- *This section details on the original issue you should resolve* <issue_title>java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity - glide</issue_title> <issue_description>### Description Random issue that I can not reproduce but happening on a small subset of devices according to firebase I believe a previously closed issue maybe the same thing happening: #17549 ### Steps to Reproduce No enough information to say at this point. ### Link to public reproduction project repository _No response_ ### Version with bug 9.0.70 SR7 ### Is this a regression from previous behavior? Yes, this used to work in .NET MAUI ### Last version that worked well 7.0.92 ### Affected platforms Android ### Affected platform versions Android 14 and up ### Did you find any workaround? No ### Relevant log output ```shell Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{######/crc641b109f8ad35faaaf.MainActivity}: java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4206) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) Caused by java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed(RequestManagerRetriever.java:236) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:110) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:92) at com.bumptech.glide.Glide.with(Glide.java:545) at com.microsoft.maui.PlatformInterop.loadImageFromFont(PlatformInterop.java:394) at crc641b109f8ad35faaaf.MainActivity.n_onCreate(MainActivity.java) at crc641b109f8ad35faaaf.MainActivity.onCreate(MainActivity.java:63) at android.app.Activity.performCreate(Activity.java:9079) at android.app.Activity.performCreate(Activity.java:9057) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1531) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4188) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) ```</issue_description> <agent_instructions>Looking at the stack trace above, it looks like the problem started in `loadImageFromFont()`. This PR: * #29780 Fixes the `clear()` code path, can we apply this to the stack trace on this issue?</agent_instructions> ## Comments on the Issue (you are @copilot in this section) <comments> <comment_new><author>@NafeelaNazhir</author><body> This issue has been verified in Visual Studio Code 1.100.2 with MAUI versions (9.0.70, 9.0.60, 9.0.50, 9.0.0). It cannot be reproduced on the Android(14.0+) platform. Is there any specific configuration needed for replicate the issue? https://github.com/user-attachments/assets/2... </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #29699 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/dotnet/maui/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
PureWeen
pushed a commit
that referenced
this pull request
Feb 13, 2026
…ctivities (#33805) - [x] Analyze the issue and understand the crash from stack trace - [x] Review PR #29780 fix pattern for destroyed activity context check - [x] Add context destruction check in `PlatformInterop.loadImageFromFont(Context...)` method - [x] Add context destruction check in other `PlatformInterop` methods that use `Glide.with(context)`: - [x] `loadImageFromFile(Context...)` - [x] `loadImageFromUri(Context...)` - [x] `loadImageFromStream(Context...)` - [x] Verify changes compile successfully - [x] Move `isContextDestroyed` and `getActivity` methods to `PlatformInterop` and have `MauiCustomTarget` call them - [x] Run code review - [x] Run CodeQL security scan - [x] Final verification <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> ---- *This section details on the original issue you should resolve* <issue_title>java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity - glide</issue_title> <issue_description>### Description Random issue that I can not reproduce but happening on a small subset of devices according to firebase I believe a previously closed issue maybe the same thing happening: #17549 ### Steps to Reproduce No enough information to say at this point. ### Link to public reproduction project repository _No response_ ### Version with bug 9.0.70 SR7 ### Is this a regression from previous behavior? Yes, this used to work in .NET MAUI ### Last version that worked well 7.0.92 ### Affected platforms Android ### Affected platform versions Android 14 and up ### Did you find any workaround? No ### Relevant log output ```shell Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{######/crc641b109f8ad35faaaf.MainActivity}: java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4206) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) Caused by java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed(RequestManagerRetriever.java:236) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:110) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:92) at com.bumptech.glide.Glide.with(Glide.java:545) at com.microsoft.maui.PlatformInterop.loadImageFromFont(PlatformInterop.java:394) at crc641b109f8ad35faaaf.MainActivity.n_onCreate(MainActivity.java) at crc641b109f8ad35faaaf.MainActivity.onCreate(MainActivity.java:63) at android.app.Activity.performCreate(Activity.java:9079) at android.app.Activity.performCreate(Activity.java:9057) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1531) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4188) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) ```</issue_description> <agent_instructions>Looking at the stack trace above, it looks like the problem started in `loadImageFromFont()`. This PR: * #29780 Fixes the `clear()` code path, can we apply this to the stack trace on this issue?</agent_instructions> ## Comments on the Issue (you are @copilot in this section) <comments> <comment_new><author>@NafeelaNazhir</author><body> This issue has been verified in Visual Studio Code 1.100.2 with MAUI versions (9.0.70, 9.0.60, 9.0.50, 9.0.0). It cannot be reproduced on the Android(14.0+) platform. Is there any specific configuration needed for replicate the issue? https://github.com/user-attachments/assets/2... </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #29699 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/dotnet/maui/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
github-actions bot
pushed a commit
that referenced
this pull request
Feb 15, 2026
…ctivities (#33805) - [x] Analyze the issue and understand the crash from stack trace - [x] Review PR #29780 fix pattern for destroyed activity context check - [x] Add context destruction check in `PlatformInterop.loadImageFromFont(Context...)` method - [x] Add context destruction check in other `PlatformInterop` methods that use `Glide.with(context)`: - [x] `loadImageFromFile(Context...)` - [x] `loadImageFromUri(Context...)` - [x] `loadImageFromStream(Context...)` - [x] Verify changes compile successfully - [x] Move `isContextDestroyed` and `getActivity` methods to `PlatformInterop` and have `MauiCustomTarget` call them - [x] Run code review - [x] Run CodeQL security scan - [x] Final verification <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> ---- *This section details on the original issue you should resolve* <issue_title>java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity - glide</issue_title> <issue_description>### Description Random issue that I can not reproduce but happening on a small subset of devices according to firebase I believe a previously closed issue maybe the same thing happening: #17549 ### Steps to Reproduce No enough information to say at this point. ### Link to public reproduction project repository _No response_ ### Version with bug 9.0.70 SR7 ### Is this a regression from previous behavior? Yes, this used to work in .NET MAUI ### Last version that worked well 7.0.92 ### Affected platforms Android ### Affected platform versions Android 14 and up ### Did you find any workaround? No ### Relevant log output ```shell Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{######/crc641b109f8ad35faaaf.MainActivity}: java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4206) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) Caused by java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed(RequestManagerRetriever.java:236) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:110) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:92) at com.bumptech.glide.Glide.with(Glide.java:545) at com.microsoft.maui.PlatformInterop.loadImageFromFont(PlatformInterop.java:394) at crc641b109f8ad35faaaf.MainActivity.n_onCreate(MainActivity.java) at crc641b109f8ad35faaaf.MainActivity.onCreate(MainActivity.java:63) at android.app.Activity.performCreate(Activity.java:9079) at android.app.Activity.performCreate(Activity.java:9057) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1531) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4188) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) ```</issue_description> <agent_instructions>Looking at the stack trace above, it looks like the problem started in `loadImageFromFont()`. This PR: * #29780 Fixes the `clear()` code path, can we apply this to the stack trace on this issue?</agent_instructions> ## Comments on the Issue (you are @copilot in this section) <comments> <comment_new><author>@NafeelaNazhir</author><body> This issue has been verified in Visual Studio Code 1.100.2 with MAUI versions (9.0.70, 9.0.60, 9.0.50, 9.0.0). It cannot be reproduced on the Android(14.0+) platform. Is there any specific configuration needed for replicate the issue? https://github.com/user-attachments/assets/2... </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #29699 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/dotnet/maui/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
github-actions bot
pushed a commit
that referenced
this pull request
Feb 19, 2026
…ctivities (#33805) - [x] Analyze the issue and understand the crash from stack trace - [x] Review PR #29780 fix pattern for destroyed activity context check - [x] Add context destruction check in `PlatformInterop.loadImageFromFont(Context...)` method - [x] Add context destruction check in other `PlatformInterop` methods that use `Glide.with(context)`: - [x] `loadImageFromFile(Context...)` - [x] `loadImageFromUri(Context...)` - [x] `loadImageFromStream(Context...)` - [x] Verify changes compile successfully - [x] Move `isContextDestroyed` and `getActivity` methods to `PlatformInterop` and have `MauiCustomTarget` call them - [x] Run code review - [x] Run CodeQL security scan - [x] Final verification <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> ---- *This section details on the original issue you should resolve* <issue_title>java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity - glide</issue_title> <issue_description>### Description Random issue that I can not reproduce but happening on a small subset of devices according to firebase I believe a previously closed issue maybe the same thing happening: #17549 ### Steps to Reproduce No enough information to say at this point. ### Link to public reproduction project repository _No response_ ### Version with bug 9.0.70 SR7 ### Is this a regression from previous behavior? Yes, this used to work in .NET MAUI ### Last version that worked well 7.0.92 ### Affected platforms Android ### Affected platform versions Android 14 and up ### Did you find any workaround? No ### Relevant log output ```shell Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{######/crc641b109f8ad35faaaf.MainActivity}: java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4206) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) Caused by java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed(RequestManagerRetriever.java:236) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:110) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:92) at com.bumptech.glide.Glide.with(Glide.java:545) at com.microsoft.maui.PlatformInterop.loadImageFromFont(PlatformInterop.java:394) at crc641b109f8ad35faaaf.MainActivity.n_onCreate(MainActivity.java) at crc641b109f8ad35faaaf.MainActivity.onCreate(MainActivity.java:63) at android.app.Activity.performCreate(Activity.java:9079) at android.app.Activity.performCreate(Activity.java:9057) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1531) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4188) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) ```</issue_description> <agent_instructions>Looking at the stack trace above, it looks like the problem started in `loadImageFromFont()`. This PR: * #29780 Fixes the `clear()` code path, can we apply this to the stack trace on this issue?</agent_instructions> ## Comments on the Issue (you are @copilot in this section) <comments> <comment_new><author>@NafeelaNazhir</author><body> This issue has been verified in Visual Studio Code 1.100.2 with MAUI versions (9.0.70, 9.0.60, 9.0.50, 9.0.0). It cannot be reproduced on the Android(14.0+) platform. Is there any specific configuration needed for replicate the issue? https://github.com/user-attachments/assets/2... </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #29699 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/dotnet/maui/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
github-actions bot
pushed a commit
that referenced
this pull request
Feb 21, 2026
…ctivities (#33805) - [x] Analyze the issue and understand the crash from stack trace - [x] Review PR #29780 fix pattern for destroyed activity context check - [x] Add context destruction check in `PlatformInterop.loadImageFromFont(Context...)` method - [x] Add context destruction check in other `PlatformInterop` methods that use `Glide.with(context)`: - [x] `loadImageFromFile(Context...)` - [x] `loadImageFromUri(Context...)` - [x] `loadImageFromStream(Context...)` - [x] Verify changes compile successfully - [x] Move `isContextDestroyed` and `getActivity` methods to `PlatformInterop` and have `MauiCustomTarget` call them - [x] Run code review - [x] Run CodeQL security scan - [x] Final verification <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> ---- *This section details on the original issue you should resolve* <issue_title>java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity - glide</issue_title> <issue_description>### Description Random issue that I can not reproduce but happening on a small subset of devices according to firebase I believe a previously closed issue maybe the same thing happening: #17549 ### Steps to Reproduce No enough information to say at this point. ### Link to public reproduction project repository _No response_ ### Version with bug 9.0.70 SR7 ### Is this a regression from previous behavior? Yes, this used to work in .NET MAUI ### Last version that worked well 7.0.92 ### Affected platforms Android ### Affected platform versions Android 14 and up ### Did you find any workaround? No ### Relevant log output ```shell Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{######/crc641b109f8ad35faaaf.MainActivity}: java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4206) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) Caused by java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed(RequestManagerRetriever.java:236) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:110) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:92) at com.bumptech.glide.Glide.with(Glide.java:545) at com.microsoft.maui.PlatformInterop.loadImageFromFont(PlatformInterop.java:394) at crc641b109f8ad35faaaf.MainActivity.n_onCreate(MainActivity.java) at crc641b109f8ad35faaaf.MainActivity.onCreate(MainActivity.java:63) at android.app.Activity.performCreate(Activity.java:9079) at android.app.Activity.performCreate(Activity.java:9057) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1531) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4188) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) ```</issue_description> <agent_instructions>Looking at the stack trace above, it looks like the problem started in `loadImageFromFont()`. This PR: * #29780 Fixes the `clear()` code path, can we apply this to the stack trace on this issue?</agent_instructions> ## Comments on the Issue (you are @copilot in this section) <comments> <comment_new><author>@NafeelaNazhir</author><body> This issue has been verified in Visual Studio Code 1.100.2 with MAUI versions (9.0.70, 9.0.60, 9.0.50, 9.0.0). It cannot be reproduced on the Android(14.0+) platform. Is there any specific configuration needed for replicate the issue? https://github.com/user-attachments/assets/2... </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #29699 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/dotnet/maui/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
github-actions bot
pushed a commit
that referenced
this pull request
Feb 24, 2026
…ctivities (#33805) - [x] Analyze the issue and understand the crash from stack trace - [x] Review PR #29780 fix pattern for destroyed activity context check - [x] Add context destruction check in `PlatformInterop.loadImageFromFont(Context...)` method - [x] Add context destruction check in other `PlatformInterop` methods that use `Glide.with(context)`: - [x] `loadImageFromFile(Context...)` - [x] `loadImageFromUri(Context...)` - [x] `loadImageFromStream(Context...)` - [x] Verify changes compile successfully - [x] Move `isContextDestroyed` and `getActivity` methods to `PlatformInterop` and have `MauiCustomTarget` call them - [x] Run code review - [x] Run CodeQL security scan - [x] Final verification <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> ---- *This section details on the original issue you should resolve* <issue_title>java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity - glide</issue_title> <issue_description>### Description Random issue that I can not reproduce but happening on a small subset of devices according to firebase I believe a previously closed issue maybe the same thing happening: #17549 ### Steps to Reproduce No enough information to say at this point. ### Link to public reproduction project repository _No response_ ### Version with bug 9.0.70 SR7 ### Is this a regression from previous behavior? Yes, this used to work in .NET MAUI ### Last version that worked well 7.0.92 ### Affected platforms Android ### Affected platform versions Android 14 and up ### Did you find any workaround? No ### Relevant log output ```shell Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{######/crc641b109f8ad35faaaf.MainActivity}: java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4206) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) Caused by java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed(RequestManagerRetriever.java:236) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:110) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:92) at com.bumptech.glide.Glide.with(Glide.java:545) at com.microsoft.maui.PlatformInterop.loadImageFromFont(PlatformInterop.java:394) at crc641b109f8ad35faaaf.MainActivity.n_onCreate(MainActivity.java) at crc641b109f8ad35faaaf.MainActivity.onCreate(MainActivity.java:63) at android.app.Activity.performCreate(Activity.java:9079) at android.app.Activity.performCreate(Activity.java:9057) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1531) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4188) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) ```</issue_description> <agent_instructions>Looking at the stack trace above, it looks like the problem started in `loadImageFromFont()`. This PR: * #29780 Fixes the `clear()` code path, can we apply this to the stack trace on this issue?</agent_instructions> ## Comments on the Issue (you are @copilot in this section) <comments> <comment_new><author>@NafeelaNazhir</author><body> This issue has been verified in Visual Studio Code 1.100.2 with MAUI versions (9.0.70, 9.0.60, 9.0.50, 9.0.0). It cannot be reproduced on the Android(14.0+) platform. Is there any specific configuration needed for replicate the issue? https://github.com/user-attachments/assets/2... </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #29699 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/dotnet/maui/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
PureWeen
pushed a commit
that referenced
this pull request
Feb 26, 2026
…ctivities (#33805) - [x] Analyze the issue and understand the crash from stack trace - [x] Review PR #29780 fix pattern for destroyed activity context check - [x] Add context destruction check in `PlatformInterop.loadImageFromFont(Context...)` method - [x] Add context destruction check in other `PlatformInterop` methods that use `Glide.with(context)`: - [x] `loadImageFromFile(Context...)` - [x] `loadImageFromUri(Context...)` - [x] `loadImageFromStream(Context...)` - [x] Verify changes compile successfully - [x] Move `isContextDestroyed` and `getActivity` methods to `PlatformInterop` and have `MauiCustomTarget` call them - [x] Run code review - [x] Run CodeQL security scan - [x] Final verification <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> ---- *This section details on the original issue you should resolve* <issue_title>java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity - glide</issue_title> <issue_description>### Description Random issue that I can not reproduce but happening on a small subset of devices according to firebase I believe a previously closed issue maybe the same thing happening: #17549 ### Steps to Reproduce No enough information to say at this point. ### Link to public reproduction project repository _No response_ ### Version with bug 9.0.70 SR7 ### Is this a regression from previous behavior? Yes, this used to work in .NET MAUI ### Last version that worked well 7.0.92 ### Affected platforms Android ### Affected platform versions Android 14 and up ### Did you find any workaround? No ### Relevant log output ```shell Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{######/crc641b109f8ad35faaaf.MainActivity}: java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4206) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) Caused by java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed(RequestManagerRetriever.java:236) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:110) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:92) at com.bumptech.glide.Glide.with(Glide.java:545) at com.microsoft.maui.PlatformInterop.loadImageFromFont(PlatformInterop.java:394) at crc641b109f8ad35faaaf.MainActivity.n_onCreate(MainActivity.java) at crc641b109f8ad35faaaf.MainActivity.onCreate(MainActivity.java:63) at android.app.Activity.performCreate(Activity.java:9079) at android.app.Activity.performCreate(Activity.java:9057) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1531) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4188) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) ```</issue_description> <agent_instructions>Looking at the stack trace above, it looks like the problem started in `loadImageFromFont()`. This PR: * #29780 Fixes the `clear()` code path, can we apply this to the stack trace on this issue?</agent_instructions> ## Comments on the Issue (you are @copilot in this section) <comments> <comment_new><author>@NafeelaNazhir</author><body> This issue has been verified in Visual Studio Code 1.100.2 with MAUI versions (9.0.70, 9.0.60, 9.0.50, 9.0.0). It cannot be reproduced on the Android(14.0+) platform. Is there any specific configuration needed for replicate the issue? https://github.com/user-attachments/assets/2... </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #29699 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/dotnet/maui/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
PureWeen
pushed a commit
that referenced
this pull request
Feb 27, 2026
…ctivities (#33805) - [x] Analyze the issue and understand the crash from stack trace - [x] Review PR #29780 fix pattern for destroyed activity context check - [x] Add context destruction check in `PlatformInterop.loadImageFromFont(Context...)` method - [x] Add context destruction check in other `PlatformInterop` methods that use `Glide.with(context)`: - [x] `loadImageFromFile(Context...)` - [x] `loadImageFromUri(Context...)` - [x] `loadImageFromStream(Context...)` - [x] Verify changes compile successfully - [x] Move `isContextDestroyed` and `getActivity` methods to `PlatformInterop` and have `MauiCustomTarget` call them - [x] Run code review - [x] Run CodeQL security scan - [x] Final verification <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> ---- *This section details on the original issue you should resolve* <issue_title>java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity - glide</issue_title> <issue_description>### Description Random issue that I can not reproduce but happening on a small subset of devices according to firebase I believe a previously closed issue maybe the same thing happening: #17549 ### Steps to Reproduce No enough information to say at this point. ### Link to public reproduction project repository _No response_ ### Version with bug 9.0.70 SR7 ### Is this a regression from previous behavior? Yes, this used to work in .NET MAUI ### Last version that worked well 7.0.92 ### Affected platforms Android ### Affected platform versions Android 14 and up ### Did you find any workaround? No ### Relevant log output ```shell Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{######/crc641b109f8ad35faaaf.MainActivity}: java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4206) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) Caused by java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed(RequestManagerRetriever.java:236) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:110) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:92) at com.bumptech.glide.Glide.with(Glide.java:545) at com.microsoft.maui.PlatformInterop.loadImageFromFont(PlatformInterop.java:394) at crc641b109f8ad35faaaf.MainActivity.n_onCreate(MainActivity.java) at crc641b109f8ad35faaaf.MainActivity.onCreate(MainActivity.java:63) at android.app.Activity.performCreate(Activity.java:9079) at android.app.Activity.performCreate(Activity.java:9057) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1531) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4188) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) ```</issue_description> <agent_instructions>Looking at the stack trace above, it looks like the problem started in `loadImageFromFont()`. This PR: * #29780 Fixes the `clear()` code path, can we apply this to the stack trace on this issue?</agent_instructions> ## Comments on the Issue (you are @copilot in this section) <comments> <comment_new><author>@NafeelaNazhir</author><body> This issue has been verified in Visual Studio Code 1.100.2 with MAUI versions (9.0.70, 9.0.60, 9.0.50, 9.0.0). It cannot be reproduced on the Android(14.0+) platform. Is there any specific configuration needed for replicate the issue? https://github.com/user-attachments/assets/2... </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #29699 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/dotnet/maui/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
jfversluis
pushed a commit
that referenced
this pull request
Mar 2, 2026
…ctivities (#33805) - [x] Analyze the issue and understand the crash from stack trace - [x] Review PR #29780 fix pattern for destroyed activity context check - [x] Add context destruction check in `PlatformInterop.loadImageFromFont(Context...)` method - [x] Add context destruction check in other `PlatformInterop` methods that use `Glide.with(context)`: - [x] `loadImageFromFile(Context...)` - [x] `loadImageFromUri(Context...)` - [x] `loadImageFromStream(Context...)` - [x] Verify changes compile successfully - [x] Move `isContextDestroyed` and `getActivity` methods to `PlatformInterop` and have `MauiCustomTarget` call them - [x] Run code review - [x] Run CodeQL security scan - [x] Final verification <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> ---- *This section details on the original issue you should resolve* <issue_title>java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity - glide</issue_title> <issue_description>### Description Random issue that I can not reproduce but happening on a small subset of devices according to firebase I believe a previously closed issue maybe the same thing happening: #17549 ### Steps to Reproduce No enough information to say at this point. ### Link to public reproduction project repository _No response_ ### Version with bug 9.0.70 SR7 ### Is this a regression from previous behavior? Yes, this used to work in .NET MAUI ### Last version that worked well 7.0.92 ### Affected platforms Android ### Affected platform versions Android 14 and up ### Did you find any workaround? No ### Relevant log output ```shell Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{######/crc641b109f8ad35faaaf.MainActivity}: java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4206) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) Caused by java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed(RequestManagerRetriever.java:236) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:110) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:92) at com.bumptech.glide.Glide.with(Glide.java:545) at com.microsoft.maui.PlatformInterop.loadImageFromFont(PlatformInterop.java:394) at crc641b109f8ad35faaaf.MainActivity.n_onCreate(MainActivity.java) at crc641b109f8ad35faaaf.MainActivity.onCreate(MainActivity.java:63) at android.app.Activity.performCreate(Activity.java:9079) at android.app.Activity.performCreate(Activity.java:9057) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1531) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4188) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) ```</issue_description> <agent_instructions>Looking at the stack trace above, it looks like the problem started in `loadImageFromFont()`. This PR: * #29780 Fixes the `clear()` code path, can we apply this to the stack trace on this issue?</agent_instructions> ## Comments on the Issue (you are @copilot in this section) <comments> <comment_new><author>@NafeelaNazhir</author><body> This issue has been verified in Visual Studio Code 1.100.2 with MAUI versions (9.0.70, 9.0.60, 9.0.50, 9.0.0). It cannot be reproduced on the Android(14.0+) platform. Is there any specific configuration needed for replicate the issue? https://github.com/user-attachments/assets/2... </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #29699 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/dotnet/maui/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
jfversluis
pushed a commit
that referenced
this pull request
Mar 2, 2026
## What's Coming .NET MAUI inflight/candidate introduces significant improvements across all platforms with focus on quality, performance, and developer experience. This release includes 24 commits with various improvements, bug fixes, and enhancements. ## Animation - [Android] Fixed TransformProperties issue when a wrapper view is present by @Ahamed-Ali in #29228 <details> <summary>🔧 Fixes</summary> - [Android Image.Scale produces wrong layout](#7432) </details> ## Button - Fix ImageButton not rendering correctly based on its bounds by @Shalini-Ashokan in #28309 <details> <summary>🔧 Fixes</summary> - [ImageButton dosen't scale Image correctly](#25558) - [ButtonImage width not sizing correctly](#14346) </details> ## CollectionView - [Android] Fixed issue where group Header/Footer template was applied to all items when IsGrouped was true for an ObservableCollection by @Tamilarasan-Paranthaman in #28886 <details> <summary>🔧 Fixes</summary> - [[Android] Group Header/Footer Repeated for All Items When IsGrouped is True for ObservableCollection](#28827) </details> - [Android] CollectionView: Fix reordering when using DataTemplateSelector by @NanthiniMahalingam in #32349 <details> <summary>🔧 Fixes</summary> - [[Android][.NET9] CollectionView Reorderer doesn't work when using TemplateSelector](#32223) </details> - [Android] Fix for incorrect scroll position when using ScrollTo with a header in CollectionView by @SyedAbdulAzeemSF4852 in #30966 <details> <summary>🔧 Fixes</summary> - [Potential off-by-one error when using ScrollTo in CollectionView with a header.](#18389) </details> - Fix Incorrect Scrolling Behavior in CollectionView ScrollTo Method Using Index Value by @Shalini-Ashokan in #27246 <details> <summary>🔧 Fixes</summary> - [CollectionView ScrollTo not working under android](#27117) </details> - [Android] Fix System.IndexOutOfRangeException when scrolling CollectionView with image CarouselView by @devanathan-vaithiyanathan in #31722 <details> <summary>🔧 Fixes</summary> - [System.IndexOutOfRangeException when scrolling CollectionView with image CarouselView](#31680) </details> - [Android] Fix VerticalOffset Update When Modifying CollectionView.ItemsSource While Scrolled by @devanathan-vaithiyanathan in #26782 <details> <summary>🔧 Fixes</summary> - [CollectionView.Scrolled event offset isn't correctly reset when items change on Android](#21708) </details> ## Editor - Fixed Editor vertical text alignment not working after toggling IsVisible by @NanthiniMahalingam in #26194 <details> <summary>🔧 Fixes</summary> - [Editor vertical text alignment not working after toggling IsVisible](#25973) </details> ## Entry - [Android] Fix Numeric Entry not accepting the appropriate Decimal Separator by @devanathan-vaithiyanathan in #27376 <details> <summary>🔧 Fixes</summary> - [Numeric Entry uses wrong decimal separator in MAUI app running on Android](#17152) </details> - [Android & iOS] Entry/Editor: Dismiss keyboard when control becomes invisible by @prakashKannanSf3972 in #27340 <details> <summary>🔧 Fixes</summary> - [android allows type into hidden Entry control](#27236) </details> ## Gestures - [Android] Fixed PointerGestureRecognizer not triggering PointerMoved event by @KarthikRajaKalaimani in #33889 <details> <summary>🔧 Fixes</summary> - [PointerGestureRecognizer does not fire off PointerMove event on Android](#33690) </details> - [Android] Fix PointerMoved and PointerReleased not firing in PointerGestureRecognizer by @KarthikRajaKalaimani in #34209 <details> <summary>🔧 Fixes</summary> - [PointerGestureRecognizer does not fire off PointerMove event on Android](#33690) </details> ## Navigation - [Android] Shell: Fix OnBackButtonPressed not firing for navigation bar back button by @kubaflo in #33531 <details> <summary>🔧 Fixes</summary> - [OnBackButtonPressed not firing for Shell Navigation Bar button in .NET 10 SR2](#33523) </details> ## Shell - [iOS] Fixed Shell Navigating event showing same current and target values by @Vignesh-SF3580 in #25749 <details> <summary>🔧 Fixes</summary> - [OnNavigating wrong target when tapping the same tab](#25599) </details> - [iOS, macOS] Fixed Shell Flyout Icon is always black in iOS 26 by @Dhivya-SF4094 in #32997 <details> <summary>🔧 Fixes</summary> - [Shell Flyout Icon is always black](#32867) - [[iOS] Color Not Applied to Flyout Icon or Title on iOS 26](#33971) </details> ## TitleView - [Android] Fixed duplicate title icon when setting TitleIconImageSource Multiple times by @SubhikshaSf4851 in #31487 <details> <summary>🔧 Fixes</summary> - [[Android] Duplicate Title Icon Appears When Setting NavigationPage.TitleIconImageSource Multiple Times](#31445) </details> ## WebView - Fixed the crash on iOS when setting HeightRequest on WebView inside a ScrollView with IsVisible set to false by @Ahamed-Ali in #29022 <details> <summary>🔧 Fixes</summary> - [Specifying HeightRequest in Webview when wrapped by ScrollView set "invisible" causes crash in iOS](#26795) </details> <details> <summary>🧪 Testing (3)</summary> - [Testing] Fix for enable uitests ios26 by @TamilarasanSF4853 in #33686 - [Testing] Fixed Test case failure in PR 34173 - [02/21/2026] Candidate - 1 by @TamilarasanSF4853 in #34192 - [Testing] Fixed Test case failure in PR 34173 - [02/21/2026] Candidate - 2 by @TamilarasanSF4853 in #34233 </details> <details> <summary>📦 Other (3)</summary> - Fix Glide IllegalArgumentException in PlatformInterop for destroyed activities by @jonathanpeppers via @Copilot in #33805 - [iOS] Fix MauiCALayer and StaticCAShapeLayer crash on finalizer thread by @pshoey in #33818 <details> <summary>🔧 Fixes</summary> - [[iOS] MauiCALayer and StaticCAShapeLayer crash on finalizer thread in Release/AOT builds](#33800) </details> - Merge branch 'main' into inflight/candidate in 1a00f12 </details> **Full Changelog**: main...inflight/candidate --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com> Co-authored-by: pshoey <pshoey@users.noreply.github.com> Co-authored-by: Subhiksha Chandrasekaran <subhiksha.c@syncfusion.com> Co-authored-by: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com> Co-authored-by: prakashKannanSf3972 <127308739+prakashKannanSf3972@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com> Co-authored-by: KarthikRajaKalaimani <92777139+KarthikRajaKalaimani@users.noreply.github.com> Co-authored-by: NanthiniMahalingam <105482474+NanthiniMahalingam@users.noreply.github.com> Co-authored-by: BagavathiPerumal <bagavathiperumal.a@syncfusion.com> Co-authored-by: Vignesh-SF3580 <102575140+Vignesh-SF3580@users.noreply.github.com> Co-authored-by: Shalini-Ashokan <shalini.ashokan@syncfusion.com> Co-authored-by: Tamilarasan Paranthaman <93904422+Tamilarasan-Paranthaman@users.noreply.github.com> Co-authored-by: SyedAbdulAzeemSF4852 <syedabdulazeem.a@syncfusion.com> Co-authored-by: Ahamed-Ali <102580874+Ahamed-Ali@users.noreply.github.com> Co-authored-by: Dhivya-SF4094 <127717131+Dhivya-SF4094@users.noreply.github.com> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com> Co-authored-by: Matthew Leibowitz <mattleibow@live.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: TamilarasanSF4853 <tamilarasan.velu@syncfusion.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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
PlatformInterop.loadImageFromFont(Context...)methodPlatformInteropmethods that useGlide.with(context):loadImageFromFile(Context...)loadImageFromUri(Context...)loadImageFromStream(Context...)isContextDestroyedandgetActivitymethods toPlatformInteropand haveMauiCustomTargetcall themOriginal prompt
This section details on the original issue you should resolve
<issue_title>java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity - glide</issue_title>
<issue_description>### Description
Random issue that I can not reproduce but happening on a small subset of devices according to firebase
I believe a previously closed issue maybe the same thing happening:
#17549
Steps to Reproduce
No enough information to say at this point.
Link to public reproduction project repository
No response
Version with bug
9.0.70 SR7
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
7.0.92
Affected platforms
Android
Affected platform versions
Android 14 and up
Did you find any workaround?
No
Relevant log output
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{######/crc641b109f8ad35faaaf.MainActivity}: java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4206) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) Caused by java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed(RequestManagerRetriever.java:236) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:110) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:92) at com.bumptech.glide.Glide.with(Glide.java:545) at com.microsoft.maui.PlatformInterop.loadImageFromFont(PlatformInterop.java:394) at crc641b109f8ad35faaaf.MainActivity.n_onCreate(MainActivity.java) at crc641b109f8ad35faaaf.MainActivity.onCreate(MainActivity.java:63) at android.app.Activity.performCreate(Activity.java:9079) at android.app.Activity.performCreate(Activity.java:9057) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1531) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4188) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4393) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2773) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8934) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) ```</issue_description> <agent_instructions>Looking at the stack trace above, it looks like the problem started in `loadImageFromFont()`. This PR: * https://github.com/dotnet/maui/pull/29780 Fixes the `clear()` code path, can we apply this to the stack trace on this issue?</agent_instructions> ## Comments on the Issue (you are @copilot in this section) <comments> <comment_new><author>@NafeelaNazhir</author><body> This issue has been verified in Visual Studio Code 1.100.2 with MAUI versions (9.0.70, 9.0.60, 9.0.50, 9.0.0). It cannot be reproduced on the Android(14.0+) platform. Is there any specific configuration needed for replicate the issue? https://github.com/user-attachments/assets/2... </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes dotnet/maui#29699 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/dotnet/maui/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.