From e35d4bb4e606d82745ab6f80ecc569d8c706f492 Mon Sep 17 00:00:00 2001 From: martincostello Date: Mon, 8 Apr 2024 12:26:30 +0100 Subject: [PATCH 1/3] Add net9.0 to AoT test matrix Add .NET 9 to the AoT test matrix to try and reproduce #5518. --- .github/workflows/verifyaotcompat.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/verifyaotcompat.yml b/.github/workflows/verifyaotcompat.yml index 6a599bb5369..c1e9e164c1e 100644 --- a/.github/workflows/verifyaotcompat.yml +++ b/.github/workflows/verifyaotcompat.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false # ensures the entire test matrix is run, even if one permutation fails matrix: os: [ ubuntu-latest ] - version: [ net8.0 ] + version: [ net8.0, net9.0 ] runs-on: ${{ matrix.os }} steps: @@ -20,6 +20,10 @@ jobs: - name: Setup dotnet uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 8.0.x + 9.0.x - name: publish AOT testApp, assert static analysis warning count, and run the app shell: pwsh From 433d7efb3ed5268369baf69e5f12b04de8bf7d6d Mon Sep 17 00:00:00 2001 From: martincostello Date: Mon, 8 Apr 2024 12:32:34 +0100 Subject: [PATCH 2/3] Add net9.0 TFM Add .NET 9 TFM to OpenTelemetry.AotCompatibility.TestApp. --- build/Common.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Common.props b/build/Common.props index d54badad2c6..c9bfe563347 100644 --- a/build/Common.props +++ b/build/Common.props @@ -29,7 +29,7 @@ net8.0;net7.0;net6.0 - net8.0 + net9.0;net8.0 net8.0;net7.0;net6.0 $(TargetFrameworksForDocs);$(NetFrameworkSupportedVersions) From 5af5a3ccc65a3ec46ea500438cae7cc4713dc33e Mon Sep 17 00:00:00 2001 From: martincostello Date: Mon, 8 Apr 2024 12:55:08 +0100 Subject: [PATCH 3/3] Fix net9.0 for AoT validation Fix-up AoT validation scripts for .NET 9 to repro #5518. --- .github/workflows/verifyaotcompat.yml | 3 +-- build/test-aot-compatibility.ps1 | 26 ++++++++++++------- global.json | 2 +- ...nTelemetry.AotCompatibility.TestApp.csproj | 2 +- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/.github/workflows/verifyaotcompat.yml b/.github/workflows/verifyaotcompat.yml index c1e9e164c1e..ee111381d5a 100644 --- a/.github/workflows/verifyaotcompat.yml +++ b/.github/workflows/verifyaotcompat.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false # ensures the entire test matrix is run, even if one permutation fails matrix: - os: [ ubuntu-latest ] + os: [ ubuntu-latest, windows-latest ] version: [ net8.0, net9.0 ] runs-on: ${{ matrix.os }} @@ -28,4 +28,3 @@ jobs: - name: publish AOT testApp, assert static analysis warning count, and run the app shell: pwsh run: .\build\test-aot-compatibility.ps1 ${{ matrix.version }} - diff --git a/build/test-aot-compatibility.ps1 b/build/test-aot-compatibility.ps1 index 37483488f50..66aabdd4642 100644 --- a/build/test-aot-compatibility.ps1 +++ b/build/test-aot-compatibility.ps1 @@ -1,24 +1,35 @@ param([string]$targetNetFramework) $rootDirectory = Split-Path $PSScriptRoot -Parent -$publishOutput = dotnet publish $rootDirectory/test/OpenTelemetry.AotCompatibility.TestApp/OpenTelemetry.AotCompatibility.TestApp.csproj -nodeReuse:false /p:UseSharedCompilation=false /p:ExposeExperimentalFeatures=true +$publishOutput = dotnet publish $rootDirectory/test/OpenTelemetry.AotCompatibility.TestApp/OpenTelemetry.AotCompatibility.TestApp.csproj --framework $targetNetFramework -nodeReuse:false /p:UseSharedCompilation=false $actualWarningCount = 0 foreach ($line in $($publishOutput -split "`r`n")) { - if ($line -like "*analysis warning IL*") + if (($line -like "*analysis warning IL*") -or ($line -like "*analysis error IL*")) { Write-Host $line - $actualWarningCount += 1 } } -pushd $rootDirectory/test/OpenTelemetry.AotCompatibility.TestApp/bin/Release/$targetNetFramework/linux-x64 +Write-Host "Actual warning count is:", $actualWarningCount +$expectedWarningCount = 0 + +if ($LastExitCode -ne 0) +{ + Write-Host "There was an error while publishing AotCompatibility Test App. LastExitCode is:", $LastExitCode + Write-Host $publishOutput +} + +$runtime = $IsWindows ? "win-x64" : ($IsMacOS ? "macos-x64" : "linux-x64") +$app = $IsWindows ? "./OpenTelemetry.AotCompatibility.TestApp.exe" : "./OpenTelemetry.AotCompatibility.TestApp" + +Push-Location $rootDirectory/test/OpenTelemetry.AotCompatibility.TestApp/bin/Release/$targetNetFramework/$runtime Write-Host "Executing test App..." -./OpenTelemetry.AotCompatibility.TestApp +$app Write-Host "Finished executing test App" if ($LastExitCode -ne 0) @@ -26,10 +37,7 @@ if ($LastExitCode -ne 0) Write-Host "There was an error while executing AotCompatibility Test App. LastExitCode is:", $LastExitCode } -popd - -Write-Host "Actual warning count is:", $actualWarningCount -$expectedWarningCount = 0 +Pop-Location $testPassed = 0 if ($actualWarningCount -ne $expectedWarningCount) diff --git a/global.json b/global.json index 0aca8b12938..f79963ad10b 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { "rollForward": "latestFeature", - "version": "8.0.100" + "version": "9.0.100-preview.2.24157.14" } } diff --git a/test/OpenTelemetry.AotCompatibility.TestApp/OpenTelemetry.AotCompatibility.TestApp.csproj b/test/OpenTelemetry.AotCompatibility.TestApp/OpenTelemetry.AotCompatibility.TestApp.csproj index bf5db5a04c1..0b7dffb58aa 100644 --- a/test/OpenTelemetry.AotCompatibility.TestApp/OpenTelemetry.AotCompatibility.TestApp.csproj +++ b/test/OpenTelemetry.AotCompatibility.TestApp/OpenTelemetry.AotCompatibility.TestApp.csproj @@ -2,7 +2,7 @@ Exe - $(TargetFrameworksForAotCompatibilityTests) + $(TargetFrameworksForAotCompatibilityTests) true false true