From c1017b92a58bb0913c708c2171e2222f223bbe9c Mon Sep 17 00:00:00 2001 From: Arthur van de Vondervoort Date: Sat, 19 Sep 2026 12:13:43 +0200 Subject: [PATCH 1/6] fix(ci): exclude BCArtifact from lowest-version TFM outputs BCArtifact sandbox snapshots include SDK versions as old as v12.x, which predate the RoslynTestKit compilation target (v17.0.34). When these define the compile-time floor, the Build job hits CS1705 assembly-version mismatches on every cop test project. Filter BCArtifact sources out of the tfm-*-version-lowest pipelines so only VSIX and NuGet sources set the floor. BCArtifact sources remain in the test matrix. Co-Authored-By: Claude Opus 4.6 (1M context) --- .claude/rules/get-bc-devtools.md | 1 + .github/actions/get-bc-devtools/action.yml | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.claude/rules/get-bc-devtools.md b/.claude/rules/get-bc-devtools.md index 782683a7..7df93e13 100644 --- a/.claude/rules/get-bc-devtools.md +++ b/.claude/rules/get-bc-devtools.md @@ -52,6 +52,7 @@ This approach reads PE metadata directly from the file bytes without loading the | TFM parsing | Regex on `TargetFrameworkAttribute` value | Handles `.NETStandard`, `.NETCoreApp`, and `.NETFramework` monikers. Future .NET versions are handled automatically. | | Cache key strategy | Content-based (SHA256 hash) | Only creates new cache entries when data actually changes | | VSIX DLL discovery | Ordered candidate-path list (flat `extension/bin` first, legacy `extension/bin/Analyzers` fallback) | BC 29 moved the SDK DLLs out of the `Analyzers` folder. Candidate list is predictable and cheap; the remote path resolves all candidates in one Central Directory pass. Bin-first because the `Analyzers` folder is legacy. | +| Lowest-version TFM source | Exclude `BCArtifact` from `tfm-*-version-lowest` | BCArtifact sandbox snapshots include very old SDK versions (v12.x) that predate the RoslynTestKit compilation target, causing CS1705 assembly-version mismatches in the Build job. Only VSIX and NuGet sources define the compile-time floor; BCArtifact sources still participate in the test matrix. | ## Maintenance diff --git a/.github/actions/get-bc-devtools/action.yml b/.github/actions/get-bc-devtools/action.yml index a4e183be..6456c147 100644 --- a/.github/actions/get-bc-devtools/action.yml +++ b/.github/actions/get-bc-devtools/action.yml @@ -50,17 +50,17 @@ runs: # Lowest source per TFM # AL Language ships as netstandard2.0; ALCops consumes these from a netstandard2.1 build target - $ns21 = $sources | Where-Object { $_.tfm -eq 'netstandard2.0' -and $_.version } | + $ns21 = $sources | Where-Object { $_.tfm -eq 'netstandard2.0' -and $_.version -and $_.packageType -ne 'BCArtifact' } | Sort-Object { [version]($_.version) } | Select-Object -First 1 -ExpandProperty version Write-Host "Lowest netstandard2.0 (AL Language) version for netstandard2.1 (ALCops) builds: $ns21" - $net80 = $sources | Where-Object { $_.tfm -eq 'net8.0' -and $_.version } | + $net80 = $sources | Where-Object { $_.tfm -eq 'net8.0' -and $_.version -and $_.packageType -ne 'BCArtifact' } | Sort-Object { [version]($_.version) } | Select-Object -First 1 -ExpandProperty version Write-Host "Lowest net8.0 version: $net80" - $net100 = $sources | Where-Object { $_.tfm -eq 'net10.0' -and $_.version } | + $net100 = $sources | Where-Object { $_.tfm -eq 'net10.0' -and $_.version -and $_.packageType -ne 'BCArtifact' } | Sort-Object { [version]($_.version) } | Select-Object -First 1 -ExpandProperty version Write-Host "Lowest net10.0 version: $net100" From c697500b91bdffda749fc0957af4d55545017239 Mon Sep 17 00:00:00 2001 From: Arthur van de Vondervoort Date: Sat, 19 Sep 2026 14:20:41 +0200 Subject: [PATCH 2/6] fix(ci): drop BCArtifact test legs below the build floor The Build job compiles analyzers once per TFM against the lowest VSIX/NuGet SDK version. BCArtifact sandbox snapshots (BC 27.5, BC 28.5) ship net10.0 SDKs older than that floor, so the pre-built DLLs cannot be loaded (CS1705). The new filter in setup-test-matrix computes the per-TFM floor from VSIX/NuGet sources and drops BCArtifact entries below it; preview artifacts above the floor stay. Co-Authored-By: Claude Fable 5.1 --- .github/actions/setup-test-matrix/action.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/actions/setup-test-matrix/action.yml b/.github/actions/setup-test-matrix/action.yml index 070e1785..e5a8f5e4 100644 --- a/.github/actions/setup-test-matrix/action.yml +++ b/.github/actions/setup-test-matrix/action.yml @@ -40,6 +40,22 @@ runs: $unwantedVersions = @('16.0.21.41228', '16.0.21.42129', '16.0.21.53261', '16.0.21.57573') $deduped = $deduped | Where-Object { $unwantedVersions -notcontains $_.version } + # The Build job compiles the analyzers once per TFM against the lowest VSIX/NuGet SDK. A test leg whose SDK is + # older than that floor cannot load the pre-built DLLs (CS1705: referenced assembly has a higher version), so + # BCArtifact entries below the floor for their TFM are dropped. Entries at or above it stay (preview artifacts). + $buildFloor = @{} + $deduped | Where-Object { $_.packageType -ne 'BCArtifact' -and $_.version } | + Group-Object tfm | + ForEach-Object { + $lowest = $_.Group | Sort-Object { [version]$_.version } | Select-Object -First 1 + $buildFloor[$_.Name] = [version]$lowest.version + } + $deduped = $deduped | Where-Object { + $_.packageType -ne 'BCArtifact' -or + -not $buildFloor.ContainsKey($_.tfm) -or + [version]$_.version -ge $buildFloor[$_.tfm] + } + echo "isempty=$([string]($deduped.Count -eq 0).ToString().ToLower())" >> $env:GITHUB_OUTPUT $matrix = @{'include' = $deduped } | ConvertTo-Json -Compress echo "matrix=$($matrix)" >> $env:GITHUB_OUTPUT From b371ffb17030220568728ed6ecbe31e51da696c7 Mon Sep 17 00:00:00 2001 From: Arthur van de Vondervoort Date: Sat, 19 Sep 2026 14:21:57 +0200 Subject: [PATCH 3/6] chore: bump ALCops.RoslynTestKit to 1.5.0 Its net10.0 lib references SDK 18.0.41.39415 which matches the net10.0 build floor, so it can never trip CS1705 on any kept test leg. Co-Authored-By: Claude Fable 5.1 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index f5189842..78f632a4 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -24,7 +24,7 @@ - + From b9ca14c16eafaed1f3a6c5853e955bf6d5d0d360 Mon Sep 17 00:00:00 2001 From: Arthur van de Vondervoort Date: Sat, 19 Sep 2026 14:27:49 +0200 Subject: [PATCH 4/6] docs: correct the BCArtifact floor rationale The rules doc now describes the actual mechanism behind the VSIX/NuGet-only compile floor and the matching test-matrix filter: BC sandbox artifacts ship net10.0 SDKs older than any marketplace or NuGet net10.0 release, and pre-built analyzer DLLs cannot be loaded by an older SDK assembly. It also records the accepted detection gap and the SDK-version contract RoslynTestKit must honour. Co-Authored-By: Claude Fable 5.1 --- .claude/rules/get-bc-devtools.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.claude/rules/get-bc-devtools.md b/.claude/rules/get-bc-devtools.md index 7df93e13..ef7a3762 100644 --- a/.claude/rules/get-bc-devtools.md +++ b/.claude/rules/get-bc-devtools.md @@ -1,6 +1,7 @@ --- paths: - ".github/actions/get-bc-devtools/**" + - ".github/actions/setup-test-matrix/**" --- # Get BC DevTools Action @@ -52,7 +53,7 @@ This approach reads PE metadata directly from the file bytes without loading the | TFM parsing | Regex on `TargetFrameworkAttribute` value | Handles `.NETStandard`, `.NETCoreApp`, and `.NETFramework` monikers. Future .NET versions are handled automatically. | | Cache key strategy | Content-based (SHA256 hash) | Only creates new cache entries when data actually changes | | VSIX DLL discovery | Ordered candidate-path list (flat `extension/bin` first, legacy `extension/bin/Analyzers` fallback) | BC 29 moved the SDK DLLs out of the `Analyzers` folder. Candidate list is predictable and cheap; the remote path resolves all candidates in one Central Directory pass. Bin-first because the `Analyzers` folder is legacy. | -| Lowest-version TFM source | Exclude `BCArtifact` from `tfm-*-version-lowest` | BCArtifact sandbox snapshots include very old SDK versions (v12.x) that predate the RoslynTestKit compilation target, causing CS1705 assembly-version mismatches in the Build job. Only VSIX and NuGet sources define the compile-time floor; BCArtifact sources still participate in the test matrix. | +| Lowest-version TFM source | `get-bc-devtools` excludes `BCArtifact` from `tfm-*-version-lowest`; `setup-test-matrix` drops BCArtifact test legs below the per-TFM build floor | BC sandbox artifacts carry net10.0 SDKs older than every marketplace VSIX or NuGet net10.0 release (BC 27.5 ships 16.4.41.39421, BC 28.5 ships 17.0.41.39411, vs. the NuGet floor 18.0.41.39415). Only VSIX and NuGet sources define the compile-time floor. Pre-built analyzer DLLs reference the floor SDK assembly version, so a test leg whose SDK is older fails with CS1705. `setup-test-matrix` computes the lowest non-BCArtifact version per TFM and drops BCArtifact entries below it; preview artifacts above the floor (e.g. BC 29 at 18.0.41.62505) stay and catch forward-compatibility breaks. **Accepted limitation:** an API gap between the compile floor and the net10.0 SDK shipped inside BC 27.5/28.5 containers is not detected by CI. **RoslynTestKit contract:** each of its per-TFM libs must reference an SDK version at or below the corresponding floor (1.5.0: netstandard2.1 12.0.13.24028, net8.0 16.0.22.22232, net10.0 18.0.41.39415), otherwise test legs between the two versions fail with CS1705 from RoslynTestKit itself. | ## Maintenance From 4f372604b899e7aed14c8203e1ea0a55f48a9c12 Mon Sep 17 00:00:00 2001 From: Arthur van de Vondervoort Date: Sat, 19 Sep 2026 14:30:03 +0200 Subject: [PATCH 5/6] chore: bump local net10.0 DevTools pin to 18.0.41.39415 RoslynTestKit 1.5.0 references the net10.0 SDK 18.0.41.39415, the same version CI uses as the net10.0 compile floor. The previous local pin (18.0.36.33307-beta) is older, so every cop test project failed to compile locally with CS1705. The stable NuGet package ships tools/net10.0/any. Co-Authored-By: Claude Fable 5.1 --- .vscode/Setup-BCDevTools.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/Setup-BCDevTools.ps1 b/.vscode/Setup-BCDevTools.ps1 index 6fa2ca47..687e7d40 100644 --- a/.vscode/Setup-BCDevTools.ps1 +++ b/.vscode/Setup-BCDevTools.ps1 @@ -37,8 +37,8 @@ $sources = @( PathInArchive = 'extension/bin/Analyzers' } @{ - AssemblyVersion = '18.0.36.33307' - PackageVersion = '18.0.36.33307-beta' + AssemblyVersion = '18.0.41.39415' + PackageVersion = '18.0.41.39415' TFM = 'net10.0' Type = 'NuGet' PathInArchive = 'tools/net10.0/any' From 2ec64aca502eaf91c36601b05c6c311d0056f185 Mon Sep 17 00:00:00 2001 From: Arthur van de Vondervoort Date: Sat, 19 Sep 2026 14:50:52 +0200 Subject: [PATCH 6/6] fix(ci): harden the test-matrix floor filter Compute the floor from the same source list get-bc-devtools uses, so the two floors cannot diverge when the unwanted-versions list removes a candidate. Cast versions with '-as [version]' so an unparseable version yields $null instead of a pipeline error, and wrap the matrix 'include' in @() so a single surviving entry still serializes as a JSON array. Co-Authored-By: Claude Fable 5.1 --- .github/actions/setup-test-matrix/action.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/actions/setup-test-matrix/action.yml b/.github/actions/setup-test-matrix/action.yml index e5a8f5e4..6fd96bb1 100644 --- a/.github/actions/setup-test-matrix/action.yml +++ b/.github/actions/setup-test-matrix/action.yml @@ -40,22 +40,24 @@ runs: $unwantedVersions = @('16.0.21.41228', '16.0.21.42129', '16.0.21.53261', '16.0.21.57573') $deduped = $deduped | Where-Object { $unwantedVersions -notcontains $_.version } - # The Build job compiles the analyzers once per TFM against the lowest VSIX/NuGet SDK. A test leg whose SDK is - # older than that floor cannot load the pre-built DLLs (CS1705: referenced assembly has a higher version), so - # BCArtifact entries below the floor for their TFM are dropped. Entries at or above it stay (preview artifacts). + # The Build job compiles the analyzers once per TFM against the lowest VSIX/NuGet SDK (the rule get-bc-devtools + # applies to this same source list, so both floors always agree). A test leg whose SDK is older than that floor + # cannot load the pre-built DLLs (CS1705: referenced assembly has a higher version), so BCArtifact entries below + # the floor for their TFM are dropped. Entries at or above it stay (preview artifacts). '-as [version]' yields + # $null for an unparseable version (the analysis-error sentinel) instead of throwing. $buildFloor = @{} - $deduped | Where-Object { $_.packageType -ne 'BCArtifact' -and $_.version } | + $sources | Where-Object { $_.packageType -ne 'BCArtifact' -and ($_.version -as [version]) } | Group-Object tfm | ForEach-Object { - $lowest = $_.Group | Sort-Object { [version]$_.version } | Select-Object -First 1 - $buildFloor[$_.Name] = [version]$lowest.version + $buildFloor[$_.Name] = $_.Group | ForEach-Object { $_.version -as [version] } | Sort-Object | Select-Object -First 1 } $deduped = $deduped | Where-Object { $_.packageType -ne 'BCArtifact' -or -not $buildFloor.ContainsKey($_.tfm) -or - [version]$_.version -ge $buildFloor[$_.tfm] + ($_.version -as [version]) -ge $buildFloor[$_.tfm] } echo "isempty=$([string]($deduped.Count -eq 0).ToString().ToLower())" >> $env:GITHUB_OUTPUT - $matrix = @{'include' = $deduped } | ConvertTo-Json -Compress + # @() keeps 'include' a JSON array when a single entry survives (the pipeline would unwrap it to a scalar) + $matrix = @{'include' = @($deduped) } | ConvertTo-Json -Compress echo "matrix=$($matrix)" >> $env:GITHUB_OUTPUT