Severity: Warning
File: src/Servy.Core/Helpers/ProcessKiller.cs (lines 173-221)
Code:
public bool KillProcessTreeAndParents(string processName, bool killParents = true)
{
try
{
// ... full body, including dispose loop, can throw at many points ...
}
catch
{
return false;
}
}
Explanation:
The outermost catch { return false; } (line 217-220) swallows every exception type with no logging. Compare to the sibling overload KillProcessTreeAndParents(int pid, ...) (line 224-271), which has no top-level catch-all and lets specific exceptions surface where they're actually handled and logged at the right granularity.
In practice this hides:
Win32Exception from Process.GetProcesses under handle pressure
InvalidOperationException when a process exits during the LINQ filter
ArgumentException from a pathological processName
- Anything thrown inside the
finally foreach-dispose loop (line 213-215) when one of the snapshot Process objects is in a bad state
The caller (ResourceHelper.TerminateBlockingProcesses, line 287-288) treats false as a fatal blocker and aborts the embedded-resource extraction. Operators get a generic "failed to copy embedded resource" log with zero context about why the kill failed — was it access-denied, was Servy.Restarter.exe pinned by a system service, was the SCM in a bad state? They can't tell.
Suggested fix:
Replace the catch-all with logged, typed catches at the same granularity as KillProcessTree / KillParentProcesses, e.g.:
catch (Win32Exception ex)
{
Logger.Error($"Win32 error in KillProcessTreeAndParents('{processName}'): {ex.Message}", ex);
return false;
}
catch (Exception ex)
{
Logger.Error($"Unexpected error in KillProcessTreeAndParents('{processName}'): {ex.Message}", ex);
return false;
}
so the field-troubleshooting log line names what actually went wrong.
Severity: Warning
File:
src/Servy.Core/Helpers/ProcessKiller.cs(lines 173-221)Code:
Explanation:
The outermost
catch { return false; }(line 217-220) swallows every exception type with no logging. Compare to the sibling overloadKillProcessTreeAndParents(int pid, ...)(line 224-271), which has no top-level catch-all and lets specific exceptions surface where they're actually handled and logged at the right granularity.In practice this hides:
Win32ExceptionfromProcess.GetProcessesunder handle pressureInvalidOperationExceptionwhen a process exits during the LINQ filterArgumentExceptionfrom a pathologicalprocessNamefinallyforeach-dispose loop (line 213-215) when one of the snapshot Process objects is in a bad stateThe caller (
ResourceHelper.TerminateBlockingProcesses, line 287-288) treatsfalseas a fatal blocker and aborts the embedded-resource extraction. Operators get a generic "failed to copy embedded resource" log with zero context about why the kill failed — was it access-denied, was Servy.Restarter.exe pinned by a system service, was the SCM in a bad state? They can't tell.Suggested fix:
Replace the catch-all with logged, typed catches at the same granularity as
KillProcessTree/KillParentProcesses, e.g.:so the field-troubleshooting log line names what actually went wrong.