fix(#390): Add admin elevation check to fail fast with clear error me…#477
fix(#390): Add admin elevation check to fail fast with clear error me…#477Randomlyclueless wants to merge 2 commits into
Conversation
DotDev262
left a comment
There was a problem hiding this comment.
Compilation error: duplicate using statement
In src/Infrastructure/AppRunner.cs, there is a duplicate using directive at the top of the file:
The using WinHome.Interfaces; appears twice (before and after the new line). This will prevent the code from compiling. Please remove the duplicate and re-push.
Once this is fixed and the build passes, the PR should be good to merge!
DotDev262
left a comment
There was a problem hiding this comment.
Compilation error: duplicate using statement
In src/Infrastructure/AppRunner.cs, there is a duplicate using directive at the top of the file:
Lines 1 and 3 both have using WinHome.Interfaces; — this won't compile. Please remove the duplicate.
Once this is fixed and the build passes, the PR should be good to merge!
DotDev262
left a comment
There was a problem hiding this comment.
Compilation error: duplicate using statement
In src/Infrastructure/AppRunner.cs, using WinHome.Interfaces; appears twice:
using WinHome.Interfaces; // line 1 — KEEP
using WinHome.Models;
using WinHome.Services.Logging;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;
using WinHome.Infrastructure.Helpers; // NEW line
using WinHome.Interfaces; // line 7 — REMOVE THIS (duplicate)
Remove the duplicate using WinHome.Interfaces; on line 7, keep everything else. Once fixed and build passes, this is ready to merge.
Closes #390
Proposed Changes
src/Infrastructure/Helpers/AdminGuard.cs— a static guard class that checks for Windows administrator privileges using WindowsPrincipal/WindowsIdentity, following the same pattern as the existing RegistryGuard.cssrc/Infrastructure/AppRunner.csto callAdminGuard.EnsureAdministrator()at the start of RunAsync(), before any config loading or system operationstests/WinHome.Tests/AdminGuardTests.cswith 3 unit tests covering admin, non-admin, and reset delegate scenariosType of Change
Screenshots / Logs (if applicable)
Non-admin shell (before fix would silently fail, now shows clear error):
![Uploading prevWinHome.png…]()
Admin shell (runs normally with full execution):
![Uploading Screenshot (12).png…]()
Testing & Verification
dotnet testand all 60+ cross-platform tests passed (537 total: 536 succeeded, 1 skipped).GSSOC 2026 Checklist
dotnet format,uv tool run ruff format plugins/, andbun x prettier --write plugins/).gssoc:approvedlabel for this PR to count for points.