Skip to content

ServiceDependenciesValidator regex rejects valid service names containing dots #324

@Christophe-Rogiers

Description

@Christophe-Rogiers

Description

In src/Servy.Core/ServiceDependencies/ServiceDependenciesValidator.cs (line 8):

private static readonly Regex ValidServiceNameRegex = new(@"^[a-zA-Z0-9_-]+$", RegexOptions.Compiled);

The regex only allows [a-zA-Z0-9_-], but many real Windows service names contain dots:

  • Servy.Service
  • MSSQL.SQLEXPRESS
  • dotnet.host
  • W32Time.NTP

Users cannot configure dependencies on any service whose name contains a dot.

Severity

Warning — blocks a common and valid Windows service naming convention.

Suggested fix

Add . to the allowed characters:

private static readonly Regex ValidServiceNameRegex = new(@"^[a-zA-Z0-9_.\-]+$", RegexOptions.Compiled);

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions