Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .claude/rules/get-bc-devtools.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
paths:
- ".github/actions/get-bc-devtools/**"
- ".github/actions/setup-test-matrix/**"
---

# Get BC DevTools Action
Expand Down Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions .github/actions/get-bc-devtools/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
20 changes: 19 additions & 1 deletion .github/actions/setup-test-matrix/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions .vscode/Setup-BCDevTools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<!-- Test projects -->
<ItemGroup>
<PackageVersion Include="ALCops.RoslynTestKit" Version="1.4.1" />
<PackageVersion Include="ALCops.RoslynTestKit" Version="1.5.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.14.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
Expand Down
Loading