Skip to content

[Robustness] ServiceControllerWrapper.cs — BuildDependencyTree re-expands shared deps in diamond patterns #578

@Christophe-Rogiers

Description

@Christophe-Rogiers

Severity: Warning

File: src/Servy.Core/Services/ServiceControllerWrapper.cs
Lines: 105–163

Description:
BuildDependencyTree uses a List<string> path-tracking approach for cycle detection. For diamond dependencies (A → B, A → C, both B and C → D), service D is fully expanded twice. For wide dependency trees this causes redundant SCM queries and O(n²) overhead. The variable name and XML doc comment also don't match (visited in doc vs currentPath in code).

Suggested fix:
Use a separate global HashSet<string> for already-fully-expanded nodes to avoid redundant traversal. Fix the doc comment to match currentPath.

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