diff --git a/.github/actions/environment/action.yml b/.github/actions/environment/action.yml index dbabc5f41c..c0610e145c 100644 --- a/.github/actions/environment/action.yml +++ b/.github/actions/environment/action.yml @@ -97,7 +97,7 @@ runs: global-json-file: global.json dotnet-version: | 8.0.x - 9.0.304 + 9.0.310 # .NET 5.0 does not support ARM64 on macOS - name: Install .NET 5.0 SDK diff --git a/.github/workflows/device-tests-android.yml b/.github/workflows/device-tests-android.yml index ac294f3dba..a3fa287e15 100644 --- a/.github/workflows/device-tests-android.yml +++ b/.github/workflows/device-tests-android.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - tfm: [net9.0] + tfm: [net9.0, net10.0] env: DOTNET_CLI_TELEMETRY_OPTOUT: 1 DOTNET_NOLOGO: 1 @@ -40,13 +40,12 @@ jobs: - name: Build Android Test App run: pwsh ./scripts/device-test.ps1 android -Build -Tfm ${{ matrix.tfm }} - - name: Upload Android Test App (net9.0) - if: matrix.tfm == 'net9.0' + - name: Upload Android Test App (${{ matrix.tfm }}) uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 with: - name: device-test-android-net9.0 + name: device-test-android-${{ matrix.tfm }} if-no-files-found: error - path: test/Sentry.Maui.Device.TestApp/bin/Release/net9.0-android/android-x64/io.sentry.dotnet.maui.device.testapp-Signed.apk + path: test/Sentry.Maui.Device.TestApp/bin/Release/${{ matrix.tfm }}-android/android-x64/io.sentry.dotnet.maui.device.testapp-Signed.apk android: needs: [build] @@ -58,7 +57,7 @@ jobs: strategy: fail-fast: false matrix: - tfm: [net9.0] + tfm: [net9.0, net10.0] # Must be 34+ for new apps and app updates as of August 31, 2024. # See https://apilevels.com/ api-level: [34, 36] @@ -130,7 +129,7 @@ jobs: uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: repository: getsentry/github-workflows - ref: a5e409bd5bad4c295201cdcfe862b17c50b29ab7 # v2.14.1 + ref: 95603f4efe938315ff0dd427a1f2bb40b1889a92 # 3.2.0 path: modules/github-workflows - name: Run Integration Tests @@ -147,7 +146,7 @@ jobs: disk-size: ${{ env.ANDROID_EMULATOR_DISK_SIZE }} emulator-options: ${{ env.ANDROID_EMULATOR_OPTIONS }} disable-animations: false - script: pwsh integration-test/android.Tests.ps1 + script: pwsh integration-test/android.Tests.ps1 -dotnet_version ${{ matrix.tfm }} - name: Retry Integration Tests (if previous failed to run) if: steps.first-integration-test-run.outcome == 'failure' diff --git a/Sentry.sln b/Sentry.sln index 3e5e7719b7..d22947f576 100644 --- a/Sentry.sln +++ b/Sentry.sln @@ -275,6 +275,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "integration-test", "integra integration-test\pester.ps1 = integration-test\pester.ps1 integration-test\ios.Tests.ps1 = integration-test\ios.Tests.ps1 integration-test\msbuild.Tests.ps1 = integration-test\msbuild.Tests.ps1 + integration-test\android.Tests.ps1 = integration-test\android.Tests.ps1 EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net4-console", "net4-console", "{33793113-C7B5-434D-B5C1-6CA1A9587842}" diff --git a/integration-test/android.Tests.ps1 b/integration-test/android.Tests.ps1 index f7910a5af3..11208485b9 100644 --- a/integration-test/android.Tests.ps1 +++ b/integration-test/android.Tests.ps1 @@ -1,7 +1,12 @@ +param( + [string] $dotnet_version = "net10.0" +) + # This file contains test cases for https://pester.dev/ Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' . $PSScriptRoot/pester.ps1 +. $PSScriptRoot/common.ps1 . $PSScriptRoot/../scripts/device-test-utils.ps1 BeforeDiscovery { @@ -12,11 +17,14 @@ BeforeDiscovery { $script:emulator = Get-AndroidEmulatorId } -Describe 'MAUI app (, )' -ForEach @( - @{ tfm = "net9.0-android35.0"; configuration = "Release" } - @{ tfm = "net9.0-android35.0"; configuration = "Debug" } -) -Skip:(-not $script:emulator) { +$cases = @( + @{ configuration = 'Release' } + @{ configuration = 'Debug' } +) +Describe 'MAUI app (, )' -ForEach $cases -Skip:(-not $script:emulator) { BeforeAll { + $tfm = "$dotnet_version-android$(GetAndroidTpv $dotnet_version)" + Remove-Item -Path "$PSScriptRoot/mobile-app" -Recurse -Force -ErrorAction SilentlyContinue Copy-Item -Path "$PSScriptRoot/net9-maui" -Destination "$PSScriptRoot/mobile-app" -Recurse -Force Push-Location $PSScriptRoot/mobile-app @@ -126,9 +134,9 @@ Describe 'MAUI app (, )' -ForEach @( Dump-ServerErrors -Result $result $result.HasErrors() | Should -BeFalse - $result.Envelopes() | Should -AnyElementMatch "`"type`":`"System.ApplicationException`"" - $result.Envelopes() | Should -Not -AnyElementMatch "`"type`":`"SIGABRT`"" - $result.Envelopes() | Should -HaveCount 1 + $result.Events() | Should -AnyElementMatch "`"type`":`"System.ApplicationException`"" + $result.Events() | Should -Not -AnyElementMatch "`"type`":`"SIGABRT`"" + $result.Events() | Should -HaveCount 1 } It 'Java crash ()' { @@ -140,9 +148,9 @@ Describe 'MAUI app (, )' -ForEach @( Dump-ServerErrors -Result $result $result.HasErrors() | Should -BeFalse - $result.Envelopes() | Should -AnyElementMatch "`"type`":`"RuntimeException`"" - $result.Envelopes() | Should -Not -AnyElementMatch "`"type`":`"System.\w+Exception`"" - $result.Envelopes() | Should -HaveCount 1 + $result.Events() | Should -AnyElementMatch "`"type`":`"RuntimeException`"" + $result.Events() | Should -Not -AnyElementMatch "`"type`":`"System.\w+Exception`"" + $result.Events() | Should -HaveCount 1 } It 'Native crash ()' { @@ -154,9 +162,9 @@ Describe 'MAUI app (, )' -ForEach @( Dump-ServerErrors -Result $result $result.HasErrors() | Should -BeFalse - $result.Envelopes() | Should -AnyElementMatch "`"type`":`"SIG[A-Z]+`"" # SIGILL (x86_64), SIGTRAP (arm64-v8a) - $result.Envelopes() | Should -Not -AnyElementMatch "`"type`":`"System.\w+Exception`"" - $result.Envelopes() | Should -HaveCount 1 + $result.Events() | Should -AnyElementMatch "`"type`":`"SIG[A-Z]+`"" # SIGILL (x86_64), SIGTRAP (arm64-v8a) + $result.Events() | Should -Not -AnyElementMatch "`"type`":`"System.\w+Exception`"" + $result.Events() | Should -HaveCount 1 } It 'Null reference exception ()' { @@ -168,13 +176,13 @@ Describe 'MAUI app (, )' -ForEach @( Dump-ServerErrors -Result $result $result.HasErrors() | Should -BeFalse - $result.Envelopes() | Should -AnyElementMatch "`"type`":`"System.NullReferenceException`"" + $result.Events() | Should -AnyElementMatch "`"type`":`"System.NullReferenceException`"" # TODO: fix redundant SIGSEGV in Release (#3954) if ($configuration -eq "Release") { - { $result.Envelopes() | Should -Not -AnyElementMatch "`"type`":`"SIGSEGV`"" } | Should -Throw + { $result.Events() | Should -Not -AnyElementMatch "`"type`":`"SIGSEGV`"" } | Should -Throw } else { - $result.Envelopes() | Should -Not -AnyElementMatch "`"type`":`"SIGSEGV`"" - $result.Envelopes() | Should -HaveCount 1 + $result.Events() | Should -Not -AnyElementMatch "`"type`":`"SIGSEGV`"" + $result.Events() | Should -HaveCount 1 } } @@ -186,8 +194,8 @@ Describe 'MAUI app (, )' -ForEach @( Dump-ServerErrors -Result $result $result.HasErrors() | Should -BeFalse - $result.Envelopes() | Should -AnyElementMatch "`"type`":`"system`",`"thread_id`":`"1`",`"category`":`"device.event`",`"action`":`"BATTERY_CHANGED`"" - $result.Envelopes() | Should -HaveCount 1 + $result.Events() | Should -AnyElementMatch "`"type`":`"system`",`"thread_id`":`"1`",`"category`":`"device.event`",`"action`":`"BATTERY_CHANGED`"" + $result.Events() | Should -HaveCount 1 } It 'Delivers network breadcrumbs in main thread ()' { @@ -198,7 +206,7 @@ Describe 'MAUI app (, )' -ForEach @( Dump-ServerErrors -Result $result $result.HasErrors() | Should -BeFalse - $result.Envelopes() | Should -AnyElementMatch "`"type`":`"system`",`"thread_id`":`"1`",`"category`":`"network.event`",`"action`":`"NETWORK_CAPABILITIES_CHANGED`"" - $result.Envelopes() | Should -HaveCount 1 + $result.Events() | Should -AnyElementMatch "`"type`":`"system`",`"thread_id`":`"1`",`"category`":`"network.event`",`"action`":`"NETWORK_CAPABILITIES_CHANGED`"" + $result.Events() | Should -HaveCount 1 } } diff --git a/integration-test/cli.Tests.ps1 b/integration-test/cli.Tests.ps1 index 1217bb7376..927d771293 100644 --- a/integration-test/cli.Tests.ps1 +++ b/integration-test/cli.Tests.ps1 @@ -7,6 +7,7 @@ Describe 'Console apps () - normal build' -ForEach @( foreach ($fw in $currentFrameworks) { @{ framework = $fw } } ) { BeforeAll { + ResetLocalPackages DotnetNew 'console' 'console-app' $framework } @@ -43,6 +44,7 @@ Describe 'Console apps () - native AOT publish' -ForEach @( foreach ($fw in $currentFrameworks) { @{ framework = $fw } } ) { BeforeAll { + ResetLocalPackages DotnetNew 'console' 'console-app' $framework } @@ -105,6 +107,7 @@ Describe 'MAUI ()' -ForEach @( @{ framework = $previousFramework } ) -Skip:($env:NO_MOBILE -eq "true") { BeforeAll { + ResetLocalPackages RegisterLocalPackage 'Sentry.Android.AssemblyReader' RegisterLocalPackage 'Sentry.Bindings.Android' RegisterLocalPackage 'Sentry.Extensions.Logging' diff --git a/integration-test/common.ps1 b/integration-test/common.ps1 index 146bbabfee..36e1b9981c 100644 --- a/integration-test/common.ps1 +++ b/integration-test/common.ps1 @@ -108,9 +108,12 @@ BeforeAll { Remove-Item -Path ~/.nuget/packages/$($name.ToLower())/$packageVersion -Recurse -Force -ErrorAction SilentlyContinue } - Remove-Item -Path "$PSScriptRoot/packages" -Recurse -Force -ErrorAction SilentlyContinue - New-Item -ItemType Directory -Path "$PSScriptRoot/packages" | Out-Null - RegisterLocalPackage 'Sentry' + function ResetLocalPackages() + { + Remove-Item -Path "$PSScriptRoot/packages" -Recurse -Force -ErrorAction SilentlyContinue + New-Item -ItemType Directory -Path "$PSScriptRoot/packages" | Out-Null + RegisterLocalPackage 'Sentry' + } function RunDotnetWithSentryCLI([string] $action, [string]$project, [bool]$Symbols, [bool]$Sources, [string]$TargetFramework) { diff --git a/integration-test/ios.Tests.ps1 b/integration-test/ios.Tests.ps1 index ae694f4a41..3c38696f69 100644 --- a/integration-test/ios.Tests.ps1 +++ b/integration-test/ios.Tests.ps1 @@ -12,8 +12,11 @@ BeforeDiscovery { } Describe 'iOS app (, )' -ForEach @( - @{ tfm = "net9.0-ios18.0"; configuration = "Release" } - @{ tfm = "net9.0-ios18.0"; configuration = "Debug" } + # Note: we can't run against net10 and net9 becaus .NET 10 requires Xcode 26.2 and .NET 9 requires Xcode 26.0. + # The macOS GitHub Actions runners only have Xcode 26.1+ installed and no support for Xcode 26.2 is planned for + # net9.0-ios: https://github.com/dotnet/macios/issues/24199#issuecomment-3819021247 + @{ tfm = "net10.0-ios26.2"; configuration = "Release" } + @{ tfm = "net10.0-ios26.2"; configuration = "Debug" } ) -Skip:(-not $script:simulator) { BeforeAll { . $PSScriptRoot/../scripts/device-test-utils.ps1 diff --git a/integration-test/msbuild.Tests.ps1 b/integration-test/msbuild.Tests.ps1 index 95288d7213..8df9580533 100644 --- a/integration-test/msbuild.Tests.ps1 +++ b/integration-test/msbuild.Tests.ps1 @@ -8,6 +8,10 @@ $IsARM64 = "Arm64".Equals([System.Runtime.InteropServices.RuntimeInformation]::O # NOTE: These .NET versions are used to build a test app that consumes the Sentry # .NET SDK, and are not tied to the .NET version used to build the SDK itself. Describe 'MSBuild app' { + BeforeAll { + ResetLocalPackages + } + BeforeDiscovery { $frameworks = @() diff --git a/integration-test/net9-maui/Sentry.Maui.Device.IntegrationTestApp.csproj b/integration-test/net9-maui/Sentry.Maui.Device.IntegrationTestApp.csproj index ed6ab044f6..b609446eba 100644 --- a/integration-test/net9-maui/Sentry.Maui.Device.IntegrationTestApp.csproj +++ b/integration-test/net9-maui/Sentry.Maui.Device.IntegrationTestApp.csproj @@ -1,8 +1,11 @@ - $(TargetFrameworks);net9.0-android35.0 - $(TargetFrameworks);net9.0-ios18.0 + $(TargetFrameworks);net9.0-android35.0;net10.0-android36.0 + + $(TargetFrameworks);net10.0-ios26.2 Exe Sentry.Maui.Device.IntegrationTestApp @@ -31,7 +34,7 @@ 15.0 21.0 - 18.0 + diff --git a/integration-test/runtime.Tests.ps1 b/integration-test/runtime.Tests.ps1 index f6f98407c6..0fa357c3fa 100644 --- a/integration-test/runtime.Tests.ps1 +++ b/integration-test/runtime.Tests.ps1 @@ -7,6 +7,7 @@ Describe 'Console app NativeAOT ()' -ForEach @( foreach ($fw in $currentFrameworks) { @{ framework = $fw } } ) { BeforeAll { + ResetLocalPackages $path = './console-app' DotnetNew 'console' $path $framework @' @@ -184,6 +185,10 @@ internal class FakeTransport : ITransport # This ensures we don't have a regression for https://github.com/getsentry/sentry-dotnet/issues/2825 Describe 'Console app regression (missing System.Reflection.Metadata)' { + BeforeAll { + ResetLocalPackages + } + AfterAll { dotnet remove ./net4-console/console-app.csproj package Sentry } diff --git a/scripts/device-test-utils.ps1 b/scripts/device-test-utils.ps1 index c3f8b771b2..455e85e4e8 100644 --- a/scripts/device-test-utils.ps1 +++ b/scripts/device-test-utils.ps1 @@ -29,11 +29,11 @@ function Get-AndroidEmulatorId function Get-IosSimulatorUdid { [CmdletBinding()] param( - [string]$IosVersion = '18.5', + [string]$IosVersion = '26.0', [string[]]$PreferredDeviceTypes = @( 'com.apple.CoreSimulator.SimDeviceType.iPhone-XS', - 'com.apple.CoreSimulator.SimDeviceType.iPhone-16', - 'com.apple.CoreSimulator.SimDeviceType.iPhone-15' + 'com.apple.CoreSimulator.SimDeviceType.iPhone-17', + 'com.apple.CoreSimulator.SimDeviceType.iPhone-16' ), [string[]]$PreferredStates = @('Shutdown','Booted') ) diff --git a/scripts/device-test.ps1 b/scripts/device-test.ps1 index b42a1ecc06..dc896e2280 100644 --- a/scripts/device-test.ps1 +++ b/scripts/device-test.ps1 @@ -26,7 +26,7 @@ try { if (!$Tfm) { - $Tfm = 'net9.0' + $Tfm = 'net10.0' } $arch = (!$IsWindows -and $(uname -m) -eq 'arm64') ? 'arm64' : 'x64' if ($Platform -eq 'android') diff --git a/src/Sentry/Internal/Hub.cs b/src/Sentry/Internal/Hub.cs index f44a288b33..c378c3dc2d 100644 --- a/src/Sentry/Internal/Hub.cs +++ b/src/Sentry/Internal/Hub.cs @@ -871,7 +871,9 @@ public void Dispose() #if __IOS__ // TODO #elif ANDROID - // TODO + // TODO: For some reason the integration tests on Android fail if we Close on the Java SDK... + // https://github.com/getsentry/sentry-dotnet/blob/0adaddb7ad91d0b41a2c38aacc64727ce54b2a3b/integration-test/android.Tests.ps1#L154 + // JavaSdk.Sentry.Close(); #elif NET8_0_OR_GREATER if (SentryNative.IsAvailable) { diff --git a/test/Sentry.Maui.Device.TestApp/Sentry.Maui.Device.TestApp.csproj b/test/Sentry.Maui.Device.TestApp/Sentry.Maui.Device.TestApp.csproj index bd418f62bd..47eafa7536 100644 --- a/test/Sentry.Maui.Device.TestApp/Sentry.Maui.Device.TestApp.csproj +++ b/test/Sentry.Maui.Device.TestApp/Sentry.Maui.Device.TestApp.csproj @@ -1,8 +1,12 @@  - $(TargetFrameworks);net9.0-android - $(TargetFrameworks);net9.0-ios + $(TargetFrameworks);net9.0-android;net10.0-android + + $(TargetFrameworks);net10.0-ios $(DefineConstants);VISUAL_RUNNER @@ -34,8 +38,7 @@ 21.0 - 18.0 - + 26.2 true