Skip to content

test: add an ASP.NET Core sample for the MS.DI bridge - #135

Merged
vbreuss merged 1 commit into
mainfrom
sample/aspnetcore-web
Jul 31, 2026
Merged

test: add an ASP.NET Core sample for the MS.DI bridge#135
vbreuss merged 1 commit into
mainfrom
sample/aspnetcore-web

Conversation

@vbreuss

@vbreuss vbreuss commented Jul 31, 2026

Copy link
Copy Markdown
Member

The bridge documentation describes a host integration the repository had no end-to-end example of: only the AOT console sample existed, so the provider factory, startup warm-up and external-dependency verification were exercised by unit tests alone.

The sample runs an Awaiten container as the composition root of a minimal-API app and covers each documented claim with a request that goes over HTTP: scope alignment per request, transient freshness inside a shared scope, async-initialized singletons warmed before serving, [ImportService<T>] reaching host services, and keyed registrations bound through [FromKeyedServices].

dotnet run -- --smoke starts the host on an ephemeral port, drives every endpoint and exits non-zero on failure, so this is a test rather than a demo — the same approach Awaiten.AotSample takes for native AOT.

The projection path is used deliberately; the README records why the full AwaitenServiceProvider replacement is unsuitable for minimal APIs today.

@vbreuss vbreuss self-assigned this Jul 31, 2026
@vbreuss vbreuss added the enhancement New feature or request label Jul 31, 2026
@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown

Test Results

   18 files  ±0     18 suites  ±0   9m 13s ⏱️ -2s
1 297 tests ±0  1 296 ✅ ±0  1 💤 ±0  0 ❌ ±0 
6 280 runs  ±0  6 279 ✅ ±0  1 💤 ±0  0 ❌ ±0 

Results for commit 6122e26. ± Comparison against base commit cadaef1.

♻️ This comment has been updated with latest results.

@vbreuss
vbreuss force-pushed the sample/aspnetcore-web branch from 0f8fbf0 to 71fe81a Compare July 31, 2026 18:01
@github-actions

github-actions Bot commented Jul 31, 2026

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.482 ns 0.0197 ns 0.0184 ns 1.07 - NA
Awaiten 8 7.020 ns 0.0079 ns 0.0062 ns 1.00 - NA
MsDI 8 7.473 ns 0.0068 ns 0.0056 ns 1.06 - NA
Autofac 8 127.281 ns 0.2688 ns 0.2245 ns 18.13 656 B NA
Jab 8 3.101 ns 0.0077 ns 0.0069 ns 0.44 - NA
PureDI 8 5.465 ns 0.0149 ns 0.0132 ns 0.78 - NA
DryIoc 8 8.097 ns 0.0113 ns 0.0089 ns 1.15 - NA
SimpleInjector 8 10.742 ns 0.0093 ns 0.0073 ns 1.53 - NA
baseline* 256 8.153 ns 0.0235 ns 0.0208 ns 1.05 - NA
Awaiten 256 7.783 ns 0.0110 ns 0.0092 ns 1.00 - NA
MsDI 256 7.674 ns 0.2057 ns 0.1924 ns 0.99 - NA
Autofac 256 127.617 ns 0.9514 ns 0.8900 ns 16.40 656 B NA
Jab 256 42.746 ns 0.0872 ns 0.0816 ns 5.49 - NA
PureDI 256 8.959 ns 0.0052 ns 0.0044 ns 1.15 - NA
DryIoc 256 8.134 ns 0.0056 ns 0.0047 ns 1.05 - NA
SimpleInjector 256 14.357 ns 0.0063 ns 0.0052 ns 1.84 - 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* 240.8 ns 1.97 ns 1.54 ns 1.02 568 B 1.00
Awaiten 235.2 ns 1.63 ns 1.53 ns 1.00 568 B 1.00
MsDI 591.0 ns 3.62 ns 3.21 ns 2.51 1104 B 1.94
Autofac 6,464.0 ns 102.62 ns 95.99 ns 27.48 10784 B 18.99
Jab 181.0 ns 2.88 ns 2.69 ns 0.77 432 B 0.76
DryIoc 414.1 ns 8.24 ns 7.70 ns 1.76 944 B 1.66
SimpleInjector 738.9 ns 12.60 ns 11.79 ns 3.14 1096 B 1.93
PureDI 183.6 ns 5.03 ns 4.71 ns 0.78 632 B 1.11
Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
Intel Xeon 6973P-C 4.08GHz, 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-v4

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

Build Size Mean Error StdDev Ratio Allocated Alloc Ratio
baseline* 8 16.994 ns 0.4460 ns 0.3954 ns 1.14 144 B 1.00
Awaiten 8 14.970 ns 1.4644 ns 1.3698 ns 1.01 144 B 1.00
MsDI 8 1,193.722 ns 42.4047 ns 35.4098 ns 80.34 5688 B 39.50
Autofac 8 18,945.436 ns 165.1594 ns 146.4095 ns 1,275.07 33090 B 229.79
Jab 8 8.066 ns 0.1566 ns 0.1465 ns 0.54 96 B 0.67
PureDI 8 13.988 ns 0.3805 ns 0.3373 ns 0.94 128 B 0.89
DryIoc 8 514.748 ns 2.1510 ns 1.7962 ns 34.64 1528 B 10.61
SimpleInjector 8 8,651.151 ns 69.9021 ns 65.3865 ns 582.24 24760 B 171.94
baseline* 256 99.977 ns 1.0779 ns 0.9556 ns 1.01 2128 B 1.00
Awaiten 256 99.316 ns 2.2554 ns 1.7609 ns 1.00 2128 B 1.00
MsDI 256 10,310.810 ns 66.4280 ns 58.8867 ns 103.85 61016 B 28.67
Autofac 256 427,252.794 ns 14,169.9581 ns 12,561.2988 ns 4,303.20 737521 B 346.58
Jab 256 79.027 ns 0.8349 ns 0.7401 ns 0.80 2080 B 0.98
PureDI 256 83.237 ns 3.9459 ns 3.6910 ns 0.84 2112 B 0.99
DryIoc 256 28,115.219 ns 1,515.6051 ns 1,343.5445 ns 283.17 80812 B 37.98
SimpleInjector 256 228,404.064 ns 7,561.5278 ns 5,903.5435 ns 2,300.44 571194 B 268.42

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

The bridge documentation describes a host integration the repository had no end-to-end example of: only the AOT console sample existed, so the provider factory, startup warm-up and external-dependency verification were exercised by unit tests alone.

The sample runs an Awaiten container as the composition root of a minimal-API app and covers each documented claim with a request that goes over HTTP: scope alignment per request, transient freshness inside a shared scope, async-initialized singletons warmed before serving, `[ImportService<T>]` reaching host services, and keyed registrations bound through `[FromKeyedServices]`.

`dotnet run -- --smoke` starts the host on an ephemeral port, drives every endpoint and exits non-zero on failure, so this is a test rather than a demo — the same approach `Awaiten.AotSample` takes for native AOT.

The projection path is used deliberately; the README records why the full `AwaitenServiceProvider` replacement is unsuitable for minimal APIs today.
@vbreuss
vbreuss force-pushed the sample/aspnetcore-web branch from 71fe81a to 6122e26 Compare July 31, 2026 18:10
@sonarqubecloud

Copy link
Copy Markdown

@vbreuss vbreuss removed the enhancement New feature or request label Jul 31, 2026
@vbreuss vbreuss changed the title feat: add an ASP.NET Core sample for the MS.DI bridge test: add an ASP.NET Core sample for the MS.DI bridge Jul 31, 2026
@vbreuss
vbreuss enabled auto-merge (squash) July 31, 2026 18:15
@vbreuss
vbreuss merged commit 97c516c into main Jul 31, 2026
15 checks passed
@vbreuss
vbreuss deleted the sample/aspnetcore-web branch July 31, 2026 18:16
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