Skip to content

IServiceManager: mixed sync and async methods in same interface #114

@Christophe-Rogiers

Description

@Christophe-Rogiers

Bug Description

IServiceManager mixes async write operations (Task<bool>) with synchronous read operations in the same interface. This creates an inconsistent API surface — callers must switch between async and sync calling patterns depending on which method they use.

Actual Behavior

// IServiceManager.cs
// Async write operations (lines 24-54):
Task<bool> InstallService(...);
Task<bool> UninstallService(...);
Task<bool> StartService(...);
Task<bool> StopService(...);
Task<bool> RestartService(...);

// Sync read operations (lines 62-104):
ServiceControllerStatus GetServiceStatus(...);
bool IsServiceInstalled(...);
ServiceStartType? GetServiceStartupType(...);
List<ServiceInfo> GetAllServices(...);
ServiceDependencyNode? GetDependencies(...);

The repository layer (IServiceRepository) offers both sync and async variants for similar operations (e.g. GetByName + GetByNameAsync), but IServiceManager only provides sync versions for reads.

Expected Behavior

Either provide async versions for read operations as well, or document the design decision for keeping reads synchronous (e.g. because ServiceController API is inherently synchronous).

Environment

  • File: src/Servy.Core/Services/IServiceManager.cs
  • Lines: 24-104

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