Extract Di lifetime parsing primitives for Captive Dependency (#232)#238
Open
Skymly wants to merge 1 commit into
Open
Extract Di lifetime parsing primitives for Captive Dependency (#232)#238Skymly wants to merge 1 commit into
Skymly wants to merge 1 commit into
Conversation
…cy (#232). Move Lifetime parsing into Analyzers.Di so Captive Dependency stops duplicating ResolveLifetime logic, with InternalsVisibleTo unit tests for edge cases.
Skymly
commented
Jul 21, 2026
Skymly
left a comment
Owner
Author
There was a problem hiding this comment.
Review (#232)
Spec
-
DesignPatterns.Analyzers.DiexposesLifetime+LifetimeResolution(TryResolve/TryResolveArgument) -
CaptiveDependencyAnalyzeruses the shared primitives; privateResolveLifetime*removed on covered paths -
InternalsVisibleTo(DesignPatterns.Analyzers.Tests) - Unit tests cover constant / unknown / named / positional / omitted-argument cases (not only Verify)
- Captive Dependency Verify behaviour frozen; CI green (
build-test,build-test-net48,samples,pack)
Out of scope as designed: registration map (#233+), LifetimeMismatchAnalyzer still keeps its private copy (#236).
Standards / notes
- Extraction matches agreed seams;
internal+ IVT is the right visibility for analyzer primitives. - No behaviour change beyond the move — good for a freeze ticket.
- Minor nit (non-blocking):
DiLifetimeResolutionTestsrepeats theHolder.Registerfixture three times — fine to tidy later when #236 lands and more call sites share the helper.
Verdict
LGTM — ready to merge.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DesignPatterns.Analyzers.Diwith sharedLifetimeandLifetimeResolutionprimitives (expression + invocation-argument resolution).CaptiveDependencyAnalyzerto those primitives and remove duplicated private ResolveLifetime logic.InternalsVisibleToplus unit tests for lifetime-resolution edge cases; keep existing Captive Dependency Verify behaviour frozen.Test plan
dotnet test tests/DesignPatterns.Analyzers.Tests --filter FullyQualifiedName~DiLifetimeResolutionTestsdotnet test tests/DesignPatterns.Analyzers.Tests --filter FullyQualifiedName~CaptiveDependency|FullyQualifiedName~FactoryDelegateCaptivedotnet test DesignPatterns.slnx -c ReleaseCloses #232
Made with Cursor