[PR #2969] [MERGED] [PM-5896] Fix MAUI iOS Background crash due to lock files on suspension #45524

Closed
opened 2026-04-26 12:50:24 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/2969
Author: @fedemkr
Created: 1/31/2024
Status: Merged
Merged: 2/5/2024
Merged by: @fedemkr

Base: feature/maui-migrationHead: vault/pm-5896/ios-background-crash-fix


📝 Commits (3)

  • 00247bf PM-5896 Fix background crash on iOS due to lock files when app gets suspended. Changed loading and error placeholders of the CachedImage to not be used and use default icon of IconLabel instead changing visibility.
  • 4578b7f PM-5896 Changed methods to be protected so that they don't get removed by the linker.
  • e2a12a0 PM-5896 Added stub class and references to it so to have stronger references to Icon_Success and Icon_Error so the linker doesn't remove them.

📊 Changes

8 files changed (+187 additions, -67 deletions)

View changed files

📝 src/App/Platforms/iOS/AppDelegate.cs (+27 -29)
📝 src/Core/Controls/AuthenticatorViewCell/AuthenticatorViewCell.xaml (+17 -18)
📝 src/Core/Controls/AuthenticatorViewCell/AuthenticatorViewCell.xaml.cs (+5 -1)
src/Core/Controls/CipherViewCell/BaseCipherViewCell.cs (+103 -0)
📝 src/Core/Controls/CipherViewCell/CipherViewCell.xaml (+15 -17)
📝 src/Core/Controls/CipherViewCell/CipherViewCell.xaml.cs (+5 -1)
📝 src/Core/MauiProgram.cs (+9 -1)
📝 src/Core/Pages/Vault/CipherItemViewModel.cs (+6 -0)

📄 Description

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

Fix background crash happening on iOS due to having a lock file (login.png) when the app got to suspended state.
This is due to the CachedImage loading and error placeholders which try to load the login.png file and at the same time the user sends the app to background, and when it reaches the suspended state, sometimes the file is still locked which causes the app to crash afterwards with this reason on the crashlog RUNNINGBOARD 0xdead10cc and this message can be seen on the Console output suspended with locked system files referencing afterwards the login.png file.

Code changes

  • BaseCipherViewCell.cs: Added this class to hold the new logic for the cached image source and visibility changes between the cached image and the placeholder icon. This is shared between CipherViewCell and AuthenticatorViewCell, the two cells that had the issue.
  • CipherViewCell/AuthenticatorViewCell: Implemented the base class and changed the layout a bit so that the placeholder icon (the glyph of this icon is the same as the image login.png) is on top of the cached image to be seen correctly by the user at the proper time. Also added the cached image events so that we can toggle the visibility of the icons accordingly.
  • AppDelegate: Uncommented events upload code given that it didn't have to do with the crash.
  • CipherItemViewModel: Added a new flag IconImageSuccesfullyLoaded which is true when the cached image loads successfully and is checked on binding context changes to prevent odd behaviors on cell reuse.

Before you submit

  • Please check for formatting errors (dotnet format --verify-no-changes) (required)
  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/2969 **Author:** [@fedemkr](https://github.com/fedemkr) **Created:** 1/31/2024 **Status:** ✅ Merged **Merged:** 2/5/2024 **Merged by:** [@fedemkr](https://github.com/fedemkr) **Base:** `feature/maui-migration` ← **Head:** `vault/pm-5896/ios-background-crash-fix` --- ### 📝 Commits (3) - [`00247bf`](https://github.com/bitwarden/android/commit/00247bfb3b792977b7c35bb6bc190c55c28c8e12) PM-5896 Fix background crash on iOS due to lock files when app gets suspended. Changed loading and error placeholders of the CachedImage to not be used and use default icon of IconLabel instead changing visibility. - [`4578b7f`](https://github.com/bitwarden/android/commit/4578b7f007ab2f89ec3e19789e88402f07cd99b3) PM-5896 Changed methods to be protected so that they don't get removed by the linker. - [`e2a12a0`](https://github.com/bitwarden/android/commit/e2a12a09e43a526ad5952c562abf2def50a2b103) PM-5896 Added stub class and references to it so to have stronger references to Icon_Success and Icon_Error so the linker doesn't remove them. ### 📊 Changes **8 files changed** (+187 additions, -67 deletions) <details> <summary>View changed files</summary> 📝 `src/App/Platforms/iOS/AppDelegate.cs` (+27 -29) 📝 `src/Core/Controls/AuthenticatorViewCell/AuthenticatorViewCell.xaml` (+17 -18) 📝 `src/Core/Controls/AuthenticatorViewCell/AuthenticatorViewCell.xaml.cs` (+5 -1) ➕ `src/Core/Controls/CipherViewCell/BaseCipherViewCell.cs` (+103 -0) 📝 `src/Core/Controls/CipherViewCell/CipherViewCell.xaml` (+15 -17) 📝 `src/Core/Controls/CipherViewCell/CipherViewCell.xaml.cs` (+5 -1) 📝 `src/Core/MauiProgram.cs` (+9 -1) 📝 `src/Core/Pages/Vault/CipherItemViewModel.cs` (+6 -0) </details> ### 📄 Description ## Type of change - [X] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ## Objective <!--Describe what the purpose of this PR is. For example: what bug you're fixing or what new feature you're adding--> Fix background crash happening on iOS due to having a lock file (login.png) when the app got to suspended state. This is due to the `CachedImage` loading and error placeholders which try to load the _login.png_ file and at the same time the user sends the app to background, and when it reaches the suspended state, sometimes the file is still locked which causes the app to crash afterwards with this reason on the crashlog `RUNNINGBOARD 0xdead10cc` and this message can be seen on the Console output `suspended with locked system files` referencing afterwards the _login.png_ file. ## Code changes <!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes--> <!--Also refer to any related changes or PRs in other repositories--> * **BaseCipherViewCell.cs:** Added this class to hold the new logic for the cached image source and visibility changes between the cached image and the placeholder icon. This is shared between `CipherViewCell` and `AuthenticatorViewCell`, the two cells that had the issue. * **CipherViewCell/AuthenticatorViewCell:** Implemented the base class and changed the layout a bit so that the placeholder icon (the glyph of this icon is the same as the image `login.png`) is on top of the cached image to be seen correctly by the user at the proper time. Also added the cached image events so that we can toggle the visibility of the icons accordingly. * **AppDelegate:** Uncommented events upload code given that it didn't have to do with the crash. * **CipherItemViewModel:** Added a new flag `IconImageSuccesfullyLoaded` which is `true` when the cached image loads successfully and is checked on binding context changes to prevent odd behaviors on cell reuse. ## Before you submit - Please check for formatting errors (`dotnet format --verify-no-changes`) (required) - Please add **unit tests** where it makes sense to do so (encouraged but not required) - If this change requires a **documentation update** - notify the documentation team - If this change has particular **deployment requirements** - notify the DevOps team --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-26 12:50:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#45524