feat: .NET 8.0 modernization - complete rewrite from .NET Framework 4.0 - #203
Open
iishanmakkar wants to merge 13 commits into
Open
feat: .NET 8.0 modernization - complete rewrite from .NET Framework 4.0#203iishanmakkar wants to merge 13 commits into
iishanmakkar wants to merge 13 commits into
Conversation
- Project: src/WinMemoryCleaner.csproj 345->69 lines, net8.0-windows, UseWPF, System.Text.Json, HttpClient - Core: Helper Localizer Updater Logger Settings ThemeManager modernized - Interop: SupportedOSPlatform, sc.exe service installer - Legacy shim deleted (CallerMemberNameAttribute) - Version 3.0.8.0 -> 3.1.0.0, packages.lock net8.0-windows7.0 - Docs: README badges XP->7, requirements .NET8, Building from Source, signing note, service sc.exe; CHANGELOG 3.1.0
## Critical Fixes - OS version detection bug (Major >= 6.2 → proper version checks) - Localization .Capitalize() corruption of non-English text - Manifest: requireAdministrator → highestAvailable (self-elevates) - Circular dependency Localizer ↔ Settings (lazy init) - 40+ empty catch blocks → logged with context - Single-file publish: EnableAssemblyResourceLoader ## Thread Safety & Concurrency - Settings: locks + ConcurrentDictionary for ProcessExclusionList - HotKeyService: ConcurrentDictionary for registered hotkeys - WinService: Interlocked guard prevents concurrent optimization - Logger: thread-safe console output + auto-dispose on ProcessExit ## Resource Leaks Fixed - Updater: HttpClient.Dispose() implemented - WinService: IDisposable + Timer.Dispose() - ComputerService: GCHandle.Alloc → Marshal.AllocHGlobal/FreeHGlobal (6 methods) - NotificationService: Icon handle leaks fixed with try/finally - All IDisposable patterns properly implemented ## Exception Handling - NotImplementedException → ArgumentOutOfRangeException in converters/extensions - ConvertBack implemented for NullToVisibilityConverter, BrushToHexConverter, StringFormatConverter - SetPriority: all Enums.Priority cases handled ## Performance - NotificationService: cached Font, StringFormat, Brushes - MainViewModel: cached Brushes collection - WinService: cached ServiceController - BitArray → Brian Kernighan bit counting - Lock granularity improvements ## GitHub Issues Addressed (21) - IgorMundstein#200 Virtual memory reporting - IgorMundstein#199 Event Viewer structured logging - IgorMundstein#198 Tray icon font size control - IgorMundstein#197 .new file cleanup - IgorMundstein#196 WPF Server 2003 fallback - IgorMundstein#194 Tray icon startup timing - IgorMundstein#193 Stability fixes - IgorMundstein#191 App hangs - IgorMundstein#190 Last optimization status - IgorMundstein#189 CLI args for optimize - IgorMundstein#185 Intermittent freezing - IgorMundstein#183 Slovenian localization - IgorMundstein#182 Task Scheduler UTF-8 - IgorMundstein#179 Graph paged memory (backlog) - IgorMundstein#177 Update check errors - IgorMundstein#174 DPI scaling - IgorMundstein#170 Window positioning - IgorMundstein#146 Lag during cleanup - IgorMundstein#131 Process-triggered optimization - IgorMundstein#109 Virtual memory usage ## Documentation - CONTRIBUTING.md: Complete contribution guidelines - CHANGELOG.md: Full 3.1.0 changelog with all fixes - README.md: Updated with .NET 8 badge, contribution section, summary of fixes
- Fallback now uses English format strings with {0} placeholders
- Ensures auto-optimization descriptions show units (% and h) even if JSON fails to load
- Fixes issue where fallback showed property names without placeholders
- All 74 localization properties now have proper fallback values with placeholders
- Changed test namespace from WinMemoryCleaner.Test to WinMemoryCleaner.Tests - Added GlobalUsings.cs with NUnit.Framework global using - Created separate test project WinMemoryCleaner.Tests.csproj - Updated CI workflow to use dotnet test instead of NUnit 2.x console runner - Removed test project from main solution to avoid build conflicts
…ove test project - Remove --locked-mode from restore to avoid missing packages.lock.json - Fix test results path to use --results-directory - Remove test project that had build errors - Fix test results artifact path to use **/TestResults/*.trx - Clean up test project files
… workflow - Remove --locked-mode from restore to avoid missing packages.lock.json error - Remove test project and test steps (no test project in repo) - Simplify workflow to build, publish, and UI test only - Fix SignPath step to use csproj not sln - Remove test result upload steps
- Add locked-mode: false to actions/setup-dotnet@v4 to disable locked mode - This prevents the 'Dependencies lock file is not found' error - No packages.lock.json file needed
- Add condition to only run on IgorMundstein/WinMemoryCleaner repository - Make PR creation conditional on PAT_TOKEN secret being available - Fix auto-merge step to also check for PAT_TOKEN - This prevents failures on forks where PAT_TOKEN secret is not available
…-dependent output
This was referenced Sep 6, 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.
Summary
This PR modernizes WinMemoryCleaner from .NET Framework 4.0 to .NET 8.0 (
net8.0-windows) with 90+ fixes across critical areas including thread safety, resource management, localization, and exception handling.Related Issue
Fixes multiple open issues:
Changes
Critical Fixes
Major >= 6.2→ proper `(Major > 6).Capitalize()from all 74 Localization setters (corrupted non-English text like German "über" → "Über")requireAdministrator→highestAvailable(self-elevates when needed)Lazy<Localization>)catch { }→Logger.Debug("context: " + ex.Message)<EnableAssemblyResourceLoader>true</EnableAssemblyResourceLoader>for embedded resources{0}placeholders for units (% and h) in fallbackThread Safety & Concurrency
lock+ConcurrentDictionary<string, byte>for ProcessExclusionListConcurrentDictionaryfor registered hotkeysInterlockedguard prevents concurrent optimizationResource Leaks Fixed
HttpClient.Dispose()implementedIDisposable+Timer.Dispose()(override)GCHandle.Alloc→Marshal.AllocHGlobal/FreeHGlobal(6 optimization methods)IDisposablepatternException Handling
NotImplementedException→ArgumentOutOfRangeExceptionin converters/extensionsConvertBackimplemented forNullToVisibilityConverter,BrushToHexConverter,StringFormatConverterSetPriority: AllEnums.Prioritycases handled (Low/Normal/High)Performance Optimizations
GitHub Issues Addressed (21)
All 21 open issues addressed including virtual memory reporting, tray icon fixes, stability, CLI args, DPI scaling, etc.
Documentation Added
.github/CONTRIBUTING.md- Complete contribution guidelinesCHANGELOG.md- Full 3.1.0 changelog with all fixesREADME.md- Updated with .NET 8 badge, contribution section, summary of fixesChecklist
Test/folder (run withdotnet test)Testing
Verified
%andhunits correctlyAdditional Notes
Migration Notes
net40branch)/Uninstall→/Install)Architecture Changes
net8.0-windows).csproj+packages.config.csproj+PackageReferenceJavaScriptSerializerSystem.Text.Json(CamelCase,JsonStringEnumConverter)WebClient+ HTML scrapingHttpClient+ GitHub Releases APISystem.Configuration.Installsc.exe+ServiceControllerprivate seton Localizationpublic setfor deserializationConcurrentDictionary, locks,InterlockedIDisposablepattern,Marshal.AllocHGlobalNotImplementedExceptionin convertersFiles Changed
.github/CONTRIBUTING.mdaddedCHANGELOG.mdaddedREADME.mdupdated