Skip to content

fix: WMI disposal in SystemInfoService, brush freeze, collection expressions (CQ-002, MODERN-003)#378

Merged
laurentiu021 merged 1 commit into
mainfrom
fix/priority-2-batch
May 15, 2026
Merged

fix: WMI disposal in SystemInfoService, brush freeze, collection expressions (CQ-002, MODERN-003)#378
laurentiu021 merged 1 commit into
mainfrom
fix/priority-2-batch

Conversation

@laurentiu021

@laurentiu021 laurentiu021 commented May 15, 2026

Copy link
Copy Markdown
Owner

Summary

Priority 2 fixes from QA audit.

Changes

CQ-002: SystemInfoService WMI disposal

  • QueryOs() and QueryCpu() now dispose ManagementObjectCollection and ManagementObject via using statements
  • Consistent with BatteryService/DiskHealthService pattern

Brush freeze

  • HexToBrushConverter now calls .Freeze() on created SolidColorBrush
  • Prevents cross-thread InvalidOperationException
  • Bare catch narrowed to catch (FormatException)

MODERN-003: Array.Empty → []

  • LargeFileScanner (2), DuplicateFileService (3), DiskAnalyzerService (2) — 7 remaining instances converted

Housekeeping

  • Added INTENSIVE_CODE_AUDIT.json to .gitignore

Build

  • 0 errors

Summary by CodeRabbit

  • Bug Fixes

    • Fixed color conversion freezing on invalid input with improved exception handling
    • Enhanced system information queries to properly release resources during operation
  • Chores

    • Modernized codebase syntax patterns for improved maintainability across scanning and analysis services

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a2c915fe-8d91-4bc0-9c60-72b7ac9271e0

📥 Commits

Reviewing files that changed from the base of the PR and between b35ef62 and ed30284.

📒 Files selected for processing (7)
  • .gitignore
  • CHANGELOG.md
  • SysManager/SysManager/Helpers/OutputKindToBrushConverter.cs
  • SysManager/SysManager/Services/DiskAnalyzerService.cs
  • SysManager/SysManager/Services/DuplicateFileService.cs
  • SysManager/SysManager/Services/LargeFileScanner.cs
  • SysManager/SysManager/Services/SystemInfoService.cs
📜 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)
  • GitHub Check: Build & unit tests
  • GitHub Check: Analyze (csharp)
🔇 Additional comments (8)
SysManager/SysManager/Services/SystemInfoService.cs (2)

30-46: LGTM!


54-65: LGTM!

SysManager/SysManager/Helpers/OutputKindToBrushConverter.cs (1)

93-99: LGTM!

SysManager/SysManager/Services/DiskAnalyzerService.cs (1)

141-142: LGTM!

SysManager/SysManager/Services/DuplicateFileService.cs (2)

73-74: LGTM!


204-204: LGTM!

SysManager/SysManager/Services/LargeFileScanner.cs (1)

65-66: LGTM!

CHANGELOG.md (1)

9-20: LGTM!


📝 Walkthrough

Walkthrough

This PR consolidates maintenance improvements for v0.48.14: proper disposal of WMI ManagementObject instances in SystemInfoService query methods, narrowed exception handling in HexToBrushConverter, and collection-expression modernization replacing Array.Empty() across file-scanning services.

Changes

Resource disposal and code modernization

Layer / File(s) Summary
SystemInfoService WMI/CIM disposal refactoring
SysManager/SysManager/Services/SystemInfoService.cs
QueryOs and QueryCpu now use using var for searcher enumeration and wrap each ManagementObject in using blocks to properly release WMI resources.
HexToBrushConverter exception narrowing
SysManager/SysManager/Helpers/OutputKindToBrushConverter.cs
HexToBrushConverter.Convert now catches only FormatException during hex parsing and returns Brushes.Gray fallback on failure instead of catching all exceptions.
Collection expression modernization across services
SysManager/SysManager/Services/DiskAnalyzerService.cs, SysManager/SysManager/Services/DuplicateFileService.cs, SysManager/SysManager/Services/LargeFileScanner.cs
MeasureFolder, directory-scan loops, and Scan method replace Array.Empty<T>() with collection expressions [] for local array initialization.
Release notes for v0.48.14
CHANGELOG.md
Documents the SystemInfoService and HexToBrushConverter fixes and collection-expression modernization across services.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

🐰 Resources now flow like carrots in spring,
No leaks from WMI's delicate thing,
Collection expressions shine bright,
Array.Empty is past—new syntax takes flight,
And HexToBrush catches what truly matters, no sting! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the three main changes: WMI disposal fixes (CQ-002), brush freeze issue, and modernization to collection expressions (MODERN-003).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/priority-2-batch

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 75.00000% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ysManager/SysManager/Services/SystemInfoService.cs 61.90% 0 Missing and 8 partials ⚠️

📢 Thoughts on this report? Let us know!

var uptime = TimeSpan.Zero;
if (!string.IsNullOrEmpty(lastBootRaw))
{
try { uptime = DateTime.Now - ManagementDateTimeConverter.ToDateTime(lastBootRaw); } catch (FormatException) { } catch (InvalidCastException) { }
var uptime = TimeSpan.Zero;
if (!string.IsNullOrEmpty(lastBootRaw))
{
try { uptime = DateTime.Now - ManagementDateTimeConverter.ToDateTime(lastBootRaw); } catch (FormatException) { } catch (InvalidCastException) { }
@laurentiu021
laurentiu021 merged commit d6bf10b into main May 15, 2026
5 checks passed
@laurentiu021
laurentiu021 deleted the fix/priority-2-batch branch May 15, 2026 07:42
laurentiu021 added a commit that referenced this pull request May 22, 2026
#481)

## Summary

Fully implements the App Blocker tab, replacing the WIP placeholder.
Blocks applications from executing using the Image File Execution
Options (IFEO) registry mechanism.

## Changes

- **New**: \AppBlockerService\ — uses IFEO Debugger key to prevent app
execution. Block, unblock, check status, enumerate all blocked apps.
Fully reversible.
- **New**: \AppBlockerViewModel\ — block by name or browse, unblock
selected, refresh list, select/deselect all. Admin privilege detection.
- **New**: \BlockedApp\ model — executable name, full path, blocked
timestamp, selection state.
- **New**: \AppBlockerView.xaml\ — text input + browse, toolbar,
DataGrid.
- **Updated**: \MainWindowViewModel\ — replaced \WipAppBlocker\
placeholder with real \AppBlockerViewModel\.
- **Tests**: 5 unit tests for ViewModel and Model.

## Safety

- Confirmation dialog before block and unblock
- Admin privilege check with clear status message
- Fully reversible — unblock removes the IFEO Debugger key
- Only blocks apps marked by SysManager (checks for specific debugger
path)

Closes #378

Co-authored-by: laurentiu021 <laurentiu021@users.noreply.github.com>
laurentiu021 added a commit that referenced this pull request May 22, 2026
…essions (CQ-002, MODERN-003) (#378)

Co-authored-by: laurentiu021 <laurentiu021@users.noreply.github.com>
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.

3 participants