fix: reparse point checks, safe enumeration, async void guard#388
Conversation
- DuplicateFileService: skip reparse points (symlinks/junctions) during directory traversal to prevent infinite loops - LargeFileScanner: same reparse point check - DeepCleanupService: catch IOException/UnauthorizedAccessException during MoveNext() iteration in EnumerateFiles (not just at creation) - TrayIconService: wrap OnTimerTick async void in try-catch to prevent unhandled exceptions from crashing the application
📝 WalkthroughWalkthroughThis PR hardens four core services against filesystem and async operation failures. Two directory traversal services now skip reparse points to prevent infinite loops. File enumeration and async timer execution gain exception handling to gracefully degrade when filesystem access or exception propagation fails. ChangesStability Hardening for Filesystem Traversal and Async Operations
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
SysManager/SysManager/Services/TrayIconService.cs (1)
131-135: ⚡ Quick winLog the exception object to preserve stack trace context.
Catching here is correct, but logging only
ex.Messageloses diagnostics; prefer Serilog’s exception overload.♻️ Proposed change
- Log.Warning("TrayIcon timer tick failed: {Error}", ex.Message); + Log.Warning(ex, "TrayIcon timer tick failed");🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@SysManager/SysManager/Services/TrayIconService.cs` around lines 131 - 135, The catch block in TrayIconService currently logs only ex.Message which loses stack trace info; update the catch in the timer tick handler (the catch in TrayIconService's timer callback) to use Serilog's exception overload so the full Exception object is logged (e.g., call Log.Warning(ex, "TrayIcon timer tick failed") or equivalent) to preserve stack and exception context.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@SysManager/SysManager/Services/TrayIconService.cs`:
- Around line 131-135: The catch block in TrayIconService currently logs only
ex.Message which loses stack trace info; update the catch in the timer tick
handler (the catch in TrayIconService's timer callback) to use Serilog's
exception overload so the full Exception object is logged (e.g., call
Log.Warning(ex, "TrayIcon timer tick failed") or equivalent) to preserve stack
and exception context.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c8be5f81-04b9-4e8b-9084-47ce20dbba08
📒 Files selected for processing (5)
CHANGELOG.mdSysManager/SysManager/Services/DeepCleanupService.csSysManager/SysManager/Services/DuplicateFileService.csSysManager/SysManager/Services/LargeFileScanner.csSysManager/SysManager/Services/TrayIconService.cs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build & unit tests
- GitHub Check: Analyze (csharp)
🔇 Additional comments (4)
CHANGELOG.md (1)
9-21: LGTM!SysManager/SysManager/Services/DuplicateFileService.cs (1)
110-119: LGTM!SysManager/SysManager/Services/LargeFileScanner.cs (1)
119-128: LGTM!SysManager/SysManager/Services/DeepCleanupService.cs (1)
383-395: LGTM!
| catch (Exception ex) | ||
| { | ||
| // async void must never throw — unhandled exceptions crash the app. | ||
| Log.Warning("TrayIcon timer tick failed: {Error}", ex.Message); | ||
| } |
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
- DuplicateFileService: skip reparse points (symlinks/junctions) during directory traversal to prevent infinite loops - LargeFileScanner: same reparse point check - DeepCleanupService: catch IOException/UnauthorizedAccessException during MoveNext() iteration in EnumerateFiles (not just at creation) - TrayIconService: wrap OnTimerTick async void in try-catch to prevent unhandled exceptions from crashing the application Co-authored-by: laurentiu021 <laurentiu021@users.noreply.github.com>
Summary
Fixes infinite loop risk on symlinks, crash on mid-enumeration file access errors, and async void crash risk.
Reparse Point Check (SVC-11, SVC-19)
Safe Enumeration (CR-02)
Async Void Guard (SVC-47)
Build
Summary by CodeRabbit
Bug Fixes