Skip to content

Harden DI013 implementation mismatch analysis#14

Open
georgepwall1991 wants to merge 1 commit intomasterfrom
codex/di013-hardening
Open

Harden DI013 implementation mismatch analysis#14
georgepwall1991 wants to merge 1 commit intomasterfrom
codex/di013-hardening

Conversation

@georgepwall1991
Copy link
Owner

Summary

  • harden DI013 so it reports deterministic-invalid implementation registrations, not just basic assignability mismatches
  • validate open-generic registrations by exact type-parameter projection and treat known implementation instances distinctly from activatable implementation types
  • expand DI013 tests/docs, sync README install snippets, and bump the package to 2.2.1

Validation

  • dotnet test tests/DependencyInjection.Lifetime.Analyzers.Tests/DependencyInjection.Lifetime.Analyzers.Tests.csproj --filter DI013 --no-restore
  • dotnet test tests/DependencyInjection.Lifetime.Analyzers.Tests/DependencyInjection.Lifetime.Analyzers.Tests.csproj --no-restore
  • node tools/generate-growth-assets.mjs sync-readme --check
  • node tools/generate-growth-assets.mjs release-notes --version 2.2.1 --output-dir /tmp/di-lifetime-release-notes-2.2.1

External review

  • Claude CLI was invoked multiple times for a review pass, including constrained read-only and prompt-only runs, but it timed out on review-sized prompts in this environment and returned no findings.

- validate activatability and open generic projections
- recognize implementation instance registrations across collector paths
- expand DI013 docs, tests, and release metadata for 2.2.1

Co-authored-by: Codex <noreply@openai.com>
@github-actions
Copy link
Contributor

Summary

Summary
Generated on: 03/16/2026 - 18:33:38
Coverage date: 03/16/2026 - 18:33:36
Parser: Cobertura
Assemblies: 1
Classes: 39
Files: 38
Line coverage: 86.3% (3537 of 4096)
Covered lines: 3537
Uncovered lines: 559
Coverable lines: 4096
Total lines: 9617
Branch coverage: 72.6% (2109 of 2904)
Covered branches: 2109
Total branches: 2904
Method coverage: Feature is only available for sponsors
Tag: 81_23159748476

Coverage

DependencyInjection.Lifetime.Analyzers - 86.3%
Name Line Branch
DependencyInjection.Lifetime.Analyzers 86.3% 72.6%
DependencyInjection.Lifetime.Analyzers.CodeFixes.DI001_ScopeMustBeDisposedC
odeFixProvider
86.3% 70%
DependencyInjection.Lifetime.Analyzers.CodeFixes.DI002_ScopeEscapeCodeFixPr
ovider
69.3% 33.3%
DependencyInjection.Lifetime.Analyzers.CodeFixes.DI003_CaptiveDependencyCod
eFixProvider
75.3% 59.2%
DependencyInjection.Lifetime.Analyzers.CodeFixes.DI005_AsyncScopeRequiredCo
deFixProvider
86.7% 73.3%
DependencyInjection.Lifetime.Analyzers.CodeFixes.DI006_StaticProviderCacheC
odeFixProvider
80.2% 71.6%
DependencyInjection.Lifetime.Analyzers.CodeFixes.DI008_DisposableTransientC
odeFixProvider
83.2% 57.5%
DependencyInjection.Lifetime.Analyzers.CodeFixes.DI009_OpenGenericLifetimeM
ismatchCodeFixProvider
74.2% 47%
DependencyInjection.Lifetime.Analyzers.CodeFixes.DI014_RootProviderNotDispo
sedCodeFixProvider
80.3% 61.5%
DependencyInjection.Lifetime.Analyzers.CodeFixes.DI015_UnresolvableDependen
cyCodeFixProvider
91.6% 77.7%
DependencyInjection.Lifetime.Analyzers.CodeFixes.MemberDeclarationSyntaxExt
ensions
57.1% 33.3%
DependencyInjection.Lifetime.Analyzers.DiagnosticDescriptors 100%
DependencyInjection.Lifetime.Analyzers.Infrastructure.ConstructorSelection 100% 85.7%
DependencyInjection.Lifetime.Analyzers.Infrastructure.DependencyRequest 100%
DependencyInjection.Lifetime.Analyzers.Infrastructure.DependencyResolutionE
ngine
87.1% 79.6%
DependencyInjection.Lifetime.Analyzers.Infrastructure.FactoryAnalysis 77.5% 66.6%
DependencyInjection.Lifetime.Analyzers.Infrastructure.FactoryDependencyAnal
ysis
78.9% 65.3%
DependencyInjection.Lifetime.Analyzers.Infrastructure.MissingDependency 100%
DependencyInjection.Lifetime.Analyzers.Infrastructure.OrderedRegistration 96.1%
DependencyInjection.Lifetime.Analyzers.Infrastructure.RegistrationCollector 82.2% 72.6%
DependencyInjection.Lifetime.Analyzers.Infrastructure.ResolutionResult 100%
DependencyInjection.Lifetime.Analyzers.Infrastructure.ServiceRegistration 100%
DependencyInjection.Lifetime.Analyzers.Infrastructure.WellKnownTypes 100% 85%
DependencyInjection.Lifetime.Analyzers.Resources 90% 47%
DependencyInjection.Lifetime.Analyzers.Rules.DI001_ScopeDisposalAnalyzer 90.5% 86.6%
DependencyInjection.Lifetime.Analyzers.Rules.DI002_ScopeEscapeAnalyzer 76.4% 62.8%
DependencyInjection.Lifetime.Analyzers.Rules.DI003_CaptiveDependencyAnalyze
r
94.7% 82.2%
DependencyInjection.Lifetime.Analyzers.Rules.DI004_UseAfterDisposeAnalyzer 80.9% 65.9%
DependencyInjection.Lifetime.Analyzers.Rules.DI005_AsyncDisposalAnalyzer 73.9% 60.7%
DependencyInjection.Lifetime.Analyzers.Rules.DI006_StaticProviderCacheAnaly
zer
95.7% 80%
DependencyInjection.Lifetime.Analyzers.Rules.DI007_ServiceLocatorAntiPatter
nAnalyzer
92.9% 82.8%
DependencyInjection.Lifetime.Analyzers.Rules.DI008_DisposableTransientAnaly
zer
91.6% 85.4%
DependencyInjection.Lifetime.Analyzers.Rules.DI009_OpenGenericLifetimeMisma
tchAnalyzer
86.8% 73.8%
DependencyInjection.Lifetime.Analyzers.Rules.DI010_ConstructorOverInjection
Analyzer
91.9% 88.6%
DependencyInjection.Lifetime.Analyzers.Rules.DI011_ServiceProviderInjection
Analyzer
95.4% 90%
DependencyInjection.Lifetime.Analyzers.Rules.DI012_ConditionalRegistrationM
isuseAnalyzer
95% 70.8%
DependencyInjection.Lifetime.Analyzers.Rules.DI013_ImplementationTypeMismat
chAnalyzer
95.1% 81.7%
DependencyInjection.Lifetime.Analyzers.Rules.DI014_RootProviderNotDisposedA
nalyzer
89.4% 82.7%
DependencyInjection.Lifetime.Analyzers.Rules.DI015_UnresolvableDependencyAn
alyzer
94.7% 71%
DependencyInjection.Lifetime.Analyzers.Rules.DI016_BuildServiceProviderMisu
seAnalyzer
93.1% 84%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant