diff --git a/.claude/rules/get-bc-devtools.md b/.claude/rules/get-bc-devtools.md index 782683a7..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,6 +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 | `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 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" diff --git a/.github/actions/setup-test-matrix/action.yml b/.github/actions/setup-test-matrix/action.yml index 070e1785..6fd96bb1 100644 --- a/.github/actions/setup-test-matrix/action.yml +++ b/.github/actions/setup-test-matrix/action.yml @@ -40,6 +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 (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 = @{} + $sources | Where-Object { $_.packageType -ne 'BCArtifact' -and ($_.version -as [version]) } | + Group-Object tfm | + ForEach-Object { + $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 -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 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' 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 @@ - +