Skip to content

fix: Workaround FileNotFoundException on Android when recovering sessions#5084

Merged
jamescrosswell merged 3 commits intomainfrom
session-file-not-found
Apr 7, 2026
Merged

fix: Workaround FileNotFoundException on Android when recovering sessions#5084
jamescrosswell merged 3 commits intomainfrom
session-file-not-found

Conversation

@jamescrosswell
Copy link
Copy Markdown
Collaborator

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 30, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Fixes 🐛

  • fix: Workaround FileNotFoundException on Android when recovering sessions by jamescrosswell in #5084
  • fix: CaptureFeedback now supports multiple attachments correctly by bitsandfoxes in #5077

Dependencies ⬆️

Deps

  • chore(deps): update Native SDK to v0.13.4 by github-actions in #5081
  • chore(deps): update Java SDK to v8.37.1 by github-actions in #5071
  • chore(deps): update CLI to v3.3.4 by github-actions in #5068
  • chore(deps): update Java SDK to v8.37.0 by github-actions in #5069
  • chore(deps): update Cocoa SDK to v9.8.0 by github-actions in #5044
  • chore(deps): update Java SDK to v8.36.0 by github-actions in #5036
  • chore(deps): update epitaph to 0.1.1 by github-actions in #5036

Other

  • ci: fix workflows that always fail for fork PRs by jamescrosswell in #5065

🤖 This preview updates automatically when you update the PR.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.00%. Comparing base (9f16edb) to head (9b6f0c2).
⚠️ Report is 21 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5084      +/-   ##
==========================================
- Coverage   74.01%   74.00%   -0.01%     
==========================================
  Files         499      499              
  Lines       18066    18067       +1     
  Branches     3518     3520       +2     
==========================================
- Hits        13371    13370       -1     
- Misses       3837     3838       +1     
- Partials      858      859       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jamescrosswell jamescrosswell marked this pull request as ready for review March 30, 2026 03:11
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Removed defensive catch degrades error handling on race
    • I restored the specific FileNotFoundException/DirectoryNotFoundException catch in TryRecoverPersistedSession so TOCTOU and Android file access races remain downgraded to Debug logging.

Create PR

Or push these changes by commenting:

@cursor push f335e7cb70
Preview (f335e7cb70)
diff --git a/src/Sentry/GlobalSessionManager.cs b/src/Sentry/GlobalSessionManager.cs
--- a/src/Sentry/GlobalSessionManager.cs
+++ b/src/Sentry/GlobalSessionManager.cs
@@ -201,6 +201,12 @@
 
             return sessionUpdate;
         }
+        catch (Exception ex) when (ex is FileNotFoundException or DirectoryNotFoundException)
+        {
+            _options.LogDebug(ex, "A persisted session file was not found at '{0}'.", filePath);
+
+            return null;
+        }
         catch (Exception ex)
         {
             _options.LogError(ex, "Failed to recover persisted session from the file system '{0}'.", filePath);

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

@jamescrosswell jamescrosswell merged commit 55c41fc into main Apr 7, 2026
45 checks passed
@jamescrosswell jamescrosswell deleted the session-file-not-found branch April 7, 2026 10:07
irvinesunday added a commit to irvinesunday/Hali that referenced this pull request Apr 8, 2026
Updated [Sentry.AspNetCore](https://github.com/getsentry/sentry-dotnet)
from 6.3.0 to 6.3.1.

<details>
<summary>Release notes</summary>

_Sourced from [Sentry.AspNetCore's
releases](https://github.com/getsentry/sentry-dotnet/releases)._

## 6.3.1

### Fixes 🐛

- fix: Workaround FileNotFoundException on Android when recovering
sessions by @​jamescrosswell in
[#​5084](getsentry/sentry-dotnet#5084)
- fix: `CaptureFeedback` now supports multiple attachments correctly by
@​bitsandfoxes in
[#​5077](getsentry/sentry-dotnet#5077)

### Dependencies ⬆️

#### Deps

- chore(deps): update Native SDK to v0.13.5 by @​github-actions in
[#​5119](getsentry/sentry-dotnet#5119)
- chore(deps): update CLI to v3.3.5 by @​github-actions in
[#​5093](getsentry/sentry-dotnet#5093)
- chore(deps): update Native SDK to v0.13.4 by @​github-actions in
[#​5081](getsentry/sentry-dotnet#5081)
- chore(deps): update Java SDK to v8.37.1 by @​github-actions in
[#​5071](getsentry/sentry-dotnet#5071)
- chore(deps): update CLI to v3.3.4 by @​github-actions in
[#​5068](getsentry/sentry-dotnet#5068)
- chore(deps): update Java SDK to v8.37.0 by @​github-actions in
[#​5069](getsentry/sentry-dotnet#5069)
- chore(deps): update Cocoa SDK to v9.8.0 by @​github-actions in
[#​5044](getsentry/sentry-dotnet#5044)
- chore(deps): update Java SDK to v8.36.0 by @​github-actions in
[#​5036](getsentry/sentry-dotnet#5036)
- chore(deps): update epitaph to 0.1.1 by @​github-actions in
[#​5036](getsentry/sentry-dotnet#5036)

### Other

- chore: Update validate-pr workflow by @​stephanie-anderson in
[#​5108](getsentry/sentry-dotnet#5108)
- ci: fix workflows that always fail for fork PRs by @​jamescrosswell in
[#​5065](getsentry/sentry-dotnet#5065)

Commits viewable in [compare
view](getsentry/sentry-dotnet@6.3.0...6.3.1).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Sentry.AspNetCore&package-manager=nuget&previous-version=6.3.0&new-version=6.3.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possible regression: Failed to persist session on the file system

3 participants