From 201ff63c9dcbac4b037e35c1850eee83c2ae120d Mon Sep 17 00:00:00 2001 From: Dietmar Borgards <2646931+dborgards@users.noreply.github.com> Date: Thu, 10 Sep 2026 23:18:17 +0200 Subject: [PATCH] build: fix the red net48 leg with Polyfill instead of a hand-rolled shim `main` has been failing on windows-latest since #83 merged: DeferredEchoQueue.cs(46,43): error CS0305: Using the generic type 'TaskCompletionSource' requires 1 type arguments #81 and #83 were both green and merged four minutes apart. #81 added `DeferredEchoQueue`, which uses the non-generic `TaskCompletionSource`; #83 added the net48 leg that has to compile it. Neither pull request was ever built against the other, because `strict_required_status_checks_policy` is `false` on the `main` ruleset, so GitHub does not re-run a pull request's checks when `main` moves underneath it. The non-generic `TaskCompletionSource` is .NET 5+; netstandard2.0 and net48 have only `TaskCompletionSource`. Rather than growing the hand-rolled `TaskWaitAsyncPolyfill` a second shim, this switches to the Polyfill package, which supplies both that type and `Task.WaitAsync`, is maintained across 22 target frameworks, and is source only (developmentDependency, no lib/) so it never becomes a dependency of anything this repository ships. It also adds `global using global::Polyfills;` itself, so no call site needs a using directive. Polyfill's sources use C# 14 extension members, hence LangVersion 12 -> 14. The language version is independent of the target frameworks, so the netstandard2.0 assets are unchanged; the API approvals confirm it -- they do not move. Verified locally: net48 builds clean (0 warnings), the full solution builds clean, 409/409 tests pass on net10.0, and `dotnet pack` produces no PolyfillTargetsForNuget warning since the reference is scoped to the test project. Co-Authored-By: Claude Opus 5 --- Directory.Build.props | 9 +- Directory.Packages.props | 7 ++ .../Infrastructure/TaskWaitAsyncPolyfill.cs | 99 ------------------- tests/Directory.Build.props | 10 ++ 4 files changed, 25 insertions(+), 100 deletions(-) delete mode 100644 tests/CanKit.Pro.Tests/Infrastructure/TaskWaitAsyncPolyfill.cs diff --git a/Directory.Build.props b/Directory.Build.props index f075630..5303493 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -13,7 +13,14 @@ - 12 + + 14 enable disable true diff --git a/Directory.Packages.props b/Directory.Packages.props index 100bb21..ec7af7f 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -30,6 +30,13 @@ --> + + + + all + compile; build; analyzers; contentfiles +