You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reduce dependency graph variation attempts with conflict-directed backtracking #163
When several bindings have alternative dependency nodes, VariationalDependencyGraphBuilder explores their Cartesian product.
A failure caused by one unresolved dependency may therefore advance unrelated variants as well. For graphs containing several independent alternatives, this can cause a significant increase in repeated graph builds.
This behavior was observed while investigating #161: local constructor-resolution failures could result in a large number of graph-building attempts even though only a small subset of bindings affected each failure.
Expected behavior
A failed graph build should first advance variants related to the unresolved dependency path.
Unrelated bindings should keep their current variants.
Already tested variation states should not be rebuilt unnecessarily.
The existing exhaustive search must remain as a correctness fallback.
The first successfully resolved graph may be returned immediately.
Warnings should be produced from the final selected graph only. Failed intermediate variants do not need to contribute warnings.
If no variation resolves the graph, the existing graph error is sufficient; no additional warning about early termination is required.
Proposed solution
Introduce conflict-directed backtracking in VariationalDependencyGraphBuilder:
Collect option sets associated with unresolved dependency targets and their consumer paths to composition roots.
Advance only those prioritized option sets.
Track visited variation states and skip duplicate graph builds.
Fall back to the complete Cartesian search when directed search is exhausted.
Invalidate visited states when new dynamic nodes are discovered, because previously invalid states may become resolvable.
Expose the number of graph build attempts for regression and performance tests.
Also preserve deterministic constructor ordering:
Explicit Ordinal
OverloadResolutionPriority
Required parameter count
Accessibility
Variation index
Acceptance criteria
User scenarios with fallback constructors continue to compile and run.
Directed search does not remove any combinations available to the exhaustive search.
Independent unresolved dependency paths do not cause combinatorial growth across unrelated bindings.
A regression scenario with two independent fallback bindings requires no more than four graph builds.
Successful graphs do not report warnings originating only from rejected variants.
Existing unit, usage, and integration tests pass for all supported Roslyn versions.
Activity
#163 Honor constructor overload resolution priority
#163 Reduce dependency graph variation attempts