fix: harden WMI/event-log error handling in health score, memory check, and known folders#930
Merged
Merged
Conversation
…k, and known folders
1678407 to
dafe02f
Compare
This was referenced Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WMI/event-log correctness hardening across three services.
Changes
ManagementException/InvalidOperationExceptionbut notCOMException, which WMIGet()throws on repository/RPC faults. A transient fault crashed the whole score instead of degrading. Added aCOMExceptionarm to all three.Microsoft-Windows-MemoryDiagnostics-Resultsevent as a memory error, including event 1101 ("no errors found"), turning a clean test into a false warning. Now counts only event 1201 (errors detected), mirroring the WHEA ID guard, and only advanceslastErrorfor records that actually count. Also reordered the loop to check cancellation before the read.SHGetKnownFolderPathwas imported with avoidreturn, so its HRESULT was discarded and thecatch (COMException)was dead code (a plain LibraryImport doesn't translate HRESULT to an exception). A failed lookup returned a null/empty path instead of falling back. Now returns/checks theintHRESULT (and guards against an empty path) and applies theSpecialFolderfallback on failure.Tests
Build: 0 warnings / 0 errors. Version 1.20.40. (Stacks on #929; will rebase before merge.)