[PR #1942] [MERGED] [EC-255] Fix crash when scanning TOTP in Android #3239

Closed
opened 2025-11-26 23:30:08 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/1942
Author: @fedemkr
Created: 6/6/2022
Status: Merged
Merged: 6/7/2022
Merged by: @fedemkr

Base: masterHead: bug/EC-255-fix-totp-scan-crash


📝 Commits (1)

  • 09642e7 EC-255 fix crash when scanning TOTP; BeginInvokeOnMainThread doesn't bubble up the exception, just crashes because it throws the exception to the current main thread context; so it was changed to InvokeOnMainThreadAsync which does bubble up the exception.

📊 Changes

1 file changed (+7 additions, -2 deletions)

View changed files

📝 src/App/Pages/Vault/ScanPage.xaml.cs (+7 -2)

📄 Description

Type of change

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

Objective

Fix crash when scanning TOTP in Android. Improves previous PR: #1759

Code changes

  • ScanPage.xaml.cs: Changed Device.BeginInvokeOnMainThread(...) for await Device.InvokeOnMainThreadAsync so that exceptions are bubble up and caught by the try...catch. Also added null check just in case on OnDisappearing for the awaiting task.

Before you submit

  • I have checked for formatting errors (dotnet tool run dotnet-format --check) (required)
  • I have added unit tests where it makes sense to do so (encouraged but not required)
  • This change requires a documentation update (notify the documentation team)
  • 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/1942 **Author:** [@fedemkr](https://github.com/fedemkr) **Created:** 6/6/2022 **Status:** ✅ Merged **Merged:** 6/7/2022 **Merged by:** [@fedemkr](https://github.com/fedemkr) **Base:** `master` ← **Head:** `bug/EC-255-fix-totp-scan-crash` --- ### 📝 Commits (1) - [`09642e7`](https://github.com/bitwarden/android/commit/09642e7039400c7cbcf6d945566f3ae5bdddf2f8) EC-255 fix crash when scanning TOTP; BeginInvokeOnMainThread doesn't bubble up the exception, just crashes because it throws the exception to the current main thread context; so it was changed to InvokeOnMainThreadAsync which does bubble up the exception. ### 📊 Changes **1 file changed** (+7 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/App/Pages/Vault/ScanPage.xaml.cs` (+7 -2) </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 crash when scanning TOTP in Android. Improves previous PR: #1759 ## 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--> * **ScanPage.xaml.cs:** Changed `Device.BeginInvokeOnMainThread(...)` for `await Device.InvokeOnMainThreadAsync` so that exceptions are bubble up and caught by the try...catch. Also added null check just in case on `OnDisappearing` for the awaiting task. ## Before you submit - [X] I have checked for formatting errors (`dotnet tool run dotnet-format --check`) (required) - [ ] I have added **unit tests** where it makes sense to do so (encouraged but not required) - [ ] This change requires a **documentation update** (notify the documentation team) - [ ] 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 2025-11-26 23:30:08 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#3239