Skip to content

test: pin MS.DI conformance of the provider-replacement path - #134

Merged
vbreuss merged 1 commit into
mainfrom
test/msdi-conformance
Jul 31, 2026
Merged

test: pin MS.DI conformance of the provider-replacement path#134
vbreuss merged 1 commit into
mainfrom
test/msdi-conformance

Conversation

@vbreuss

@vbreuss vbreuss commented Jul 31, 2026

Copy link
Copy Markdown
Member

Takes the behaviours guaranteed by Microsoft.Extensions.DependencyInjection as a checklist and asserts them against AwaitenServiceProvider over compile-time containers, grouped by the guarantee under test.

The official Microsoft.Extensions.DependencyInjection.Specification.Tests suite cannot be inherited: it is built against xunit v2 while this repository is on xunit.v3, and its CreateServiceProvider(IServiceCollection) contract hands the container the types to register at run time, which a generator-fixed graph cannot honour. MsDiConformance.md records the reasoning, what is covered, and what is not applicable to a compile-time container.

One divergence surfaced and is pinned by a test asserting the current behaviour, so closing it fails the test instead of passing unnoticed: IEnumerable<T> of an element type the graph never mentions returns null where MS.DI guarantees an empty sequence.

Feature detection and disposal ownership are covered by their own suites (FeatureDetectionTests, BridgeDisposalTests) and are cross-referenced rather than duplicated here.

Takes the behaviours guaranteed by Microsoft.Extensions.DependencyInjection as a checklist and asserts them against `AwaitenServiceProvider` over compile-time containers, grouped by the guarantee under test.

The official `Microsoft.Extensions.DependencyInjection.Specification.Tests` suite cannot be inherited: it is built against xunit v2 while this repository is on xunit.v3, and its `CreateServiceProvider(IServiceCollection)` contract hands the container the types to register at run time, which a generator-fixed graph cannot honour. `MsDiConformance.md` records the reasoning, what is covered, and what is not applicable to a compile-time container.

One divergence surfaced and is pinned by a test asserting the current behaviour, so closing it fails the test instead of passing unnoticed: `IEnumerable<T>` of an element type the graph never mentions returns null where MS.DI guarantees an empty sequence.

Feature detection and disposal ownership are covered by their own suites (`FeatureDetectionTests`, `BridgeDisposalTests`) and are cross-referenced rather than duplicated here.
@vbreuss vbreuss self-assigned this Jul 31, 2026
@vbreuss
vbreuss merged commit cadaef1 into main Jul 31, 2026
10 checks passed
@vbreuss
vbreuss deleted the test/msdi-conformance branch July 31, 2026 17:36
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.302
[Host] : .NET 10.0.10 (10.0.10, 10.0.1026.32716), X64 RyuJIT x86-64-v3

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

Resolve Size Mean Error StdDev Ratio Allocated Alloc Ratio
baseline* 8 7.728 ns 0.0712 ns 0.0556 ns 1.11 1.00 -
Awaiten 8 6.991 ns 0.0109 ns 0.0085 ns 1.00 - NA
MsDI 8 7.497 ns 0.0242 ns 0.0214 ns 1.07 - NA
Autofac 8 125.175 ns 3.7098 ns 3.2886 ns 17.91 656 B NA
Jab 8 3.136 ns 0.0030 ns 0.0025 ns 0.45 - NA
PureDI 8 3.409 ns 0.0032 ns 0.0028 ns 0.49 - NA
DryIoc 8 8.608 ns 0.0078 ns 0.0065 ns 1.23 - NA
SimpleInjector 8 10.708 ns 0.0096 ns 0.0090 ns 1.53 - NA
baseline* 256 8.073 ns 0.1190 ns 0.0929 ns 1.02 1.00 -
Awaiten 256 7.929 ns 0.0059 ns 0.0052 ns 1.00 - NA
MsDI 256 7.328 ns 0.0091 ns 0.0080 ns 0.92 - NA
Autofac 256 120.499 ns 6.6439 ns 5.8896 ns 15.20 656 B NA
Jab 256 42.677 ns 0.0303 ns 0.0253 ns 5.38 - NA
PureDI 256 8.271 ns 0.0049 ns 0.0046 ns 1.04 - NA
DryIoc 256 8.408 ns 0.0053 ns 0.0050 ns 1.06 - NA
SimpleInjector 256 14.279 ns 0.0494 ns 0.0462 ns 1.80 - NA
Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.302
[Host] : .NET 10.0.10 (10.0.10, 10.0.1026.32716), X64 RyuJIT x86-64-v3

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

Realistic Mean Error StdDev Ratio Allocated Alloc Ratio
baseline* 269.9 ns 4.80 ns 4.49 ns 1.16 568 B 1.00
Awaiten 232.7 ns 1.30 ns 1.22 ns 1.00 568 B 1.00
MsDI 582.8 ns 4.34 ns 3.85 ns 2.50 1104 B 1.94
Autofac 6,783.6 ns 57.98 ns 51.40 ns 29.15 10784 B 18.99
Jab 174.9 ns 1.18 ns 1.05 ns 0.75 432 B 0.76
DryIoc 383.6 ns 1.99 ns 1.77 ns 1.65 944 B 1.66
SimpleInjector 702.8 ns 2.05 ns 1.81 ns 3.02 1096 B 1.93
PureDI 174.0 ns 0.49 ns 0.41 ns 0.75 632 B 1.11
Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.302
[Host] : .NET 10.0.10 (10.0.10, 10.0.1026.32716), X64 RyuJIT x86-64-v3

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

Build Size Mean Error StdDev Ratio Allocated Alloc Ratio
baseline* 8 16.638 ns 0.1020 ns 0.0954 ns 0.94 144 B 1.00
Awaiten 8 17.65 ns 0.256 ns 0.227 ns 1.00 144 B 1.00
MsDI 8 1,519.01 ns 16.324 ns 15.269 ns 86.09 5688 B 39.50
Autofac 8 30,988.61 ns 124.809 ns 116.746 ns 1,756.31 33098 B 229.85
Jab 8 10.68 ns 0.470 ns 0.439 ns 0.61 96 B 0.67
PureDI 8 16.24 ns 0.446 ns 0.417 ns 0.92 128 B 0.89
DryIoc 8 722.98 ns 7.627 ns 7.134 ns 40.98 1528 B 10.61
SimpleInjector 8 12,108.06 ns 282.089 ns 263.866 ns 686.24 24760 B 171.94
baseline* 256 89.251 ns 0.2436 ns 0.2279 ns 0.94 2128 B 1.00
Awaiten 256 95.22 ns 6.012 ns 5.624 ns 1.00 2128 B 1.00
MsDI 256 15,432.32 ns 208.515 ns 195.045 ns 162.56 61016 B 28.67
Autofac 256 749,095.69 ns 5,519.536 ns 4,892.925 ns 7,891.02 719743 B 338.23
Jab 256 86.46 ns 1.815 ns 1.609 ns 0.91 2080 B 0.98
PureDI 256 88.38 ns 3.379 ns 2.996 ns 0.93 2112 B 0.99
DryIoc 256 43,212.23 ns 388.158 ns 344.092 ns 455.20 80356 B 37.76
SimpleInjector 256 372,399.61 ns 6,335.039 ns 5,925.800 ns 3,922.88 573041 B 269.29

baseline* rows show the corresponding Awaiten benchmark from the most recent successful main branch build with results, for regression comparison.

github-actions Bot added a commit that referenced this pull request Jul 31, 2026
github-actions Bot added a commit that referenced this pull request Jul 31, 2026
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