fix: replace fire-and-forget async with safe InitializeAsync helper (CQ-M3)#416
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (14)
📜 Recent 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)
🔇 Additional comments (14)
📝 WalkthroughWalkthroughA new ChangesSafe async ViewModel initialization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 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 |
| catch (Exception ex) | ||
| { | ||
| Log.Error(ex, "Unhandled exception in async initialization of {Caller}", callerName); | ||
| } |
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…route DNS (#431) ## Summary **Batch 10** — final batch of the QA bug fix series. ### Issue #414 — Service WaitForStatus can hang - Wrapped \WaitForStatus\ in try-catch for \TimeoutException\ - Converts to descriptive \InvalidOperationException\ with user-friendly message - No more unhandled crash when a service takes >30s to start/stop ### Issue #415 — Snapshot not persisted to disk - Added \SaveSnapshot\/\LoadSnapshot\ to \PerformanceService\ - Persists \OriginalSnapshot\ as JSON in \%LOCALAPPDATA%\\SysManager\\performance-snapshot.json\ - \EnsureSnapshotAsync\ now: loads from disk → falls back to live capture → saves to disk - Snapshot survives app restarts — Restore All works after reopen ### Issue #416 — Traceroute DNS fire-and-forget race condition - Replaced fire-and-forget \Task.Run\ DNS lookup with awaited \Dns.GetHostEntryAsync\ - Added 1.5s timeout via \CancellationTokenSource.CreateLinkedTokenSource\ - \hop.HostName\ is now populated BEFORE emission via \HopCompleted\ - No more race condition where UI renders '*' and never updates ### Testing - Build: 0 errors Closes #414, Closes #415, Closes #416 Co-authored-by: laurentiu021 <laurentiu021@users.noreply.github.com>
Adds CHANGELOG entries for all 9 releases from the QA bug fix session: - **v0.28.16** — Dispose lifecycle (#395, #410) - **v0.28.17** — CTS disposal + bare catch (#396, #413) - **v0.28.18** — Input validation + null checks (#397, #398) - **v0.28.19** — JSON error handling (#400) - **v0.28.20** — Drive scanning + cache eviction + ConfigureAwait (#401, #402, #403) - **v0.28.21** — Audit logging + error messages (#405, #407) - **v0.28.22** — SHA256 verification (#408, #409) - **v0.28.23** — Service timeout + snapshot persist + traceroute DNS (#414, #415, #416) - **v0.28.24** — Accessibility (#411) 18 bugs fixed in total. Co-authored-by: laurentiu021 <laurentiu021@users.noreply.github.com>
…CQ-M3) (#416) Co-authored-by: laurentiu021 <laurentiu021@users.noreply.github.com>
Summary
Resolves CQ-M3: fire-and-forget async in 12 ViewModel constructors that could produce unobserved task exceptions.
Changes
ViewModelBase — new InitializeAsync helper
Added a protected static method that wraps async initialization with structured error handling:
12 ViewModels updated
Replaced bare discard pattern with the safe helper:
Why this matters
The previous pattern discarded the Task, meaning any exception thrown during async initialization would become an unobserved task exception. On .NET 6+ this doesn't crash the app by default, but the errors are silently lost — making debugging difficult. Now all initialization failures are logged with full context.
Testing
Summary by CodeRabbit