Skip to content

Update project and dependencies, enable nullable annotations - #20

Merged
tillig merged 7 commits into
developfrom
feature/update-project-and-dependencies
Aug 14, 2026
Merged

Update project and dependencies, enable nullable annotations#20
tillig merged 7 commits into
developfrom
feature/update-project-and-dependencies

Conversation

@tillig

@tillig tillig commented Aug 14, 2026

Copy link
Copy Markdown
Member

Brings the library up to current Autofac project standards ahead of the 7.0.0 release.

Changes

  • Dependencies: Autofac 9.3.2, Autofac.Mef 8.0.1, System.ComponentModel.Composition 10.0.11, plus analyzer/test-tooling bumps and SDK 10.0.302.
  • Nullable annotations enabled across source and tests. These are annotation-only changes and are binary compatible, since nullable metadata is erased at runtime and where TInterface : notnull (now required by Autofac's As<TService>()) is compiler-enforced only.
  • Build metadata aligned with the other Autofac repos: full assembly/package metadata, snupkg symbols, resx-based strings, and the test project now multi-targets net10.0 and net8.0.
  • README quick start rewritten. The previous one was copied from Autofac.Extras.AggregateService and documented aggregate services; since this branch adds PackageReadmeFile, that content would have shipped as the NuGet package page.

Notes

MetadataModule<TInterface, TMetadata>.ContainerBuilder is now ContainerBuilder?, so the public RegisterType/RegisterAttributedType methods guard it and throw InvalidOperationException when called before Load.

The README quick start centers on AttributedMetadataModule, since the filter attributes in this package (WithMetadataAttribute, WithKeyAttribute, WithAttributeFilter) are all [Obsolete] in favor of core Autofac's Autofac.Features.AttributeFilters equivalents. Snippets are adapted from the metadata docs and were verified against a scratch test before being committed.

Test fix

Does_not_throw_in_nested_lifetimeScope_builders was failing on the new Autofac. It called builder.RegisterType<int>() inside the child scope's configuration action - two latent bugs from the original 2019 commit:

  1. int is a struct, and core Autofac's RegistrationBuilder.ForType<T>() now rejects non-activatable types, so this threw instead of silently creating a registration nobody resolved.
  2. It registered into the outer, already-built builder instead of the action's ContainerBuilder, so the nested registration the test name promises never happened.

Now x.RegisterType<NestedLifetimeScopeRegistrationInstance>(). Confirmed the test still guards its original regression by temporarily removing the ContainsKey guard from AttributedMetadataModule, which reproduces the duplicate-key ArgumentException (nested scopes see parent registrations wrapped in ExternalComponentRegistration, which shares the parent's metadata dictionary by reference).

Verification

dotnet msbuild ./default.proj clean: 30/30 tests pass on net10.0 and net8.0, packages build, and the correct README is packed into the nupkg.

tillig added 7 commits August 14, 2026 11:59
This was a workaround for a local NuGet feed returning 403 for the
vulnerability audit endpoint (NU1900). Committing it disabled package
vulnerability auditing for all contributors and CI, and no other Autofac
repo sets it.
The previous Quick Start was copied from Autofac.Extras.AggregateService
and documented aggregate services. Since this branch adds
PackageReadmeFile, that content would have shipped as the NuGet package
page. Snippets are adapted from the metadata docs and center on
AttributedMetadataModule; the filter attributes in this package are all
obsolete in favor of core Autofac.
@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 39.13043% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.18%. Comparing base (61cef14) to head (2203f30).

Files with missing lines Patch % Lines
...teMetadata/MetadataModule{TInterface,TMetadata}.cs 22.22% 7 Missing and 7 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           develop      #20       +/-   ##
============================================
- Coverage    71.27%   60.18%   -11.10%     
============================================
  Files            7        7               
  Lines           94      108       +14     
  Branches        28       35        +7     
============================================
- Hits            67       65        -2     
- Misses          12       19        +7     
- Partials        15       24        +9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tillig
tillig merged commit b09a02d into develop Aug 14, 2026
10 of 12 checks passed
@tillig
tillig deleted the feature/update-project-and-dependencies branch August 14, 2026 19:37
@tillig tillig mentioned this pull request Aug 14, 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