Add Static Extensions (And fix a bug in cycle-detection)#27
Add Static Extensions (And fix a bug in cycle-detection)#27carl-andersson-at-westermo wants to merge 4 commits into
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.
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>net8.0</TargetFramework> | ||
| <TargetFramework>net10.0</TargetFramework> |
There was a problem hiding this comment.
net10.0 requires a .NET SDK that supports that TFM, but the repo CI workflows currently install dotnet-version: 9.0.x (see .github/workflows/build.yml and benchmark.yml). With this change, CI/builds will fail unless the workflows (and any local tooling expectations) are updated to use a compatible SDK, or the project stays on net9.0/net8.0.
| <TargetFramework>net10.0</TargetFramework> | |
| <TargetFramework>net9.0</TargetFramework> |
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>net8.0</TargetFramework> | ||
| <TargetFramework>net10.0</TargetFramework> |
There was a problem hiding this comment.
This project now targets net10.0, but CI currently installs .NET SDK 9.0.x in .github/workflows/build.yml. Unless the workflows are updated to install a .NET 10 SDK (or the project targets a framework supported by SDK 9), the test build will fail.
| <TargetFramework>net10.0</TargetFramework> | |
| <TargetFramework>net9.0</TargetFramework> |
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>net8.0</TargetFramework> | ||
| <TargetFramework>net10.0</TargetFramework> |
There was a problem hiding this comment.
Changing the package TFM from net8.0 to net10.0 is a breaking change for consumers on net8/net9. If the only requirement is C# 14 static-extension generation (a compiler feature), consider multi-targeting (e.g., net8.0;net10.0) or keeping net8.0 and controlling language features via LangVersion/SDK selection. Also note CI currently installs .NET SDK 9.0.x, so it will need updating to build net10.0.
| <TargetFramework>net10.0</TargetFramework> | |
| <TargetFrameworks>net8.0;net10.0</TargetFrameworks> |
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>net9.0</TargetFramework> | ||
| <TargetFramework>net10.0</TargetFramework> |
There was a problem hiding this comment.
The benchmark project now targets net10.0, but .github/workflows/benchmark.yml installs .NET SDK 9.0.x. The benchmark job will fail unless the workflow is updated to install a compatible SDK (or the project targets a framework supported by SDK 9).
| <TargetFramework>net10.0</TargetFramework> | |
| <TargetFramework>net9.0</TargetFramework> |
| using System.Runtime.InteropServices; | ||
| using FactoryGenerator.Attributes; |
There was a problem hiding this comment.
using System.Runtime.InteropServices; appears unused in this file. Removing it will avoid unnecessary usings/warnings.
| using System.Runtime.InteropServices; | |
| using FactoryGenerator.Attributes; | |
| using FactoryGenerator.Attributes; |
No description provided.