Add Static Extensions (And fix a bug in cycle-detection) - #27
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds C# 14 “static extension” based resolution generation alongside existing dictionary-based resolution, and updates cycle detection + collection/reentrancy behaviors with new tests/benchmarks.
Changes:
- Generate C# 14 static-extension
Resolve(container?)APIs (gated on parse options) and adjust generated container internals to support them. - Replace cycle detection logic with a DFS-based graph walk and add tests for cross-array reentrancy + base/child array merging.
- Update benchmarks to compare dictionary vs static-extension resolution paths; bump several projects to
net10.0/LangVersion=preview.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/TestWebApp/TestWebApp.csproj | Bumps test web app TFM to net10.0. |
| Tests/TestData/Inheritor/Types.cs | Adds split-array implementations for base/child merge tests (plus an extra using). |
| Tests/TestData/Inheritor/Inheritor.csproj | Enables LangVersion=preview for the Inheritor test-data project. |
| Tests/TestData/Inherited/Types.cs | Adds cross-array reentrancy + split-array test types. |
| Tests/FactoryGenerator.Tests/InjectionDetectionTests.cs | Adds tests covering cross-array reentrancy + array merging across container hierarchies. |
| Tests/FactoryGenerator.Extensions.AspNetCore.Tests/FactoryGenerator.Extensions.AspNetCore.Tests.csproj | Bumps AspNetCore extension tests to net10.0. |
| FactoryGenerator/FactoryGenerator.cs | Implements static-extension generation, adjusts collection naming, and rewrites cycle detection. |
| FactoryGenerator.Extensions.AspNetCore/FactoryGenerator.Extensions.AspNetCore.csproj | Bumps extension library TFM to net10.0. |
| Benchmarking/Benchmarks/Program.cs | Adds static-extension benchmarks and uses BenchmarkSwitcher. |
| Benchmarking/Benchmarks/Benchmarks.csproj | Bumps benchmarks to net10.0 + LangVersion=preview. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
carl-andersson-at-westermo
force-pushed
the
static-extensions
branch
from
July 24, 2026 07:38
40ea082 to
05aee5b
Compare
Document the C# 14 static extension methods feature that provides dictionary-free inline resolution via ISomething.Resolve(container). Add Plugin Architecture to the features list in both READMEs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
No description provided.