Skip to content

ServiceManager.GetAllServices: bare catch silently defaults startup type to Automatic #337

@Christophe-Rogiers

Description

@Christophe-Rogiers

Description

In src/Servy.Core/Services/ServiceManager.cs (line 876):

catch { /* Fallback to automatic if access denied */ }

Inside the Parallel.ForEach in GetAllServices(), the service.StartType access can throw. The bare catch (not filtered to Win32Exception) silently defaults the startup type to Automatic regardless of the actual exception type.

A service that is actually Disabled will show as Automatic in the Manager UI. There is no logging.

Severity

Warning — UI displays incorrect startup type; no diagnostic trail.

Suggested fix

  1. Filter to Win32Exception specifically
  2. Log the exception at Debug level
  3. Consider using a nullable or "Unknown" value instead of defaulting to Automatic

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions