diff --git a/.github/workflows/device-tests-android.yml b/.github/workflows/device-tests-android.yml index 50d43bc9ae..c69ef854f8 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@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.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] @@ -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 e04424c66c..ff19d3a7b2 100644 --- a/Sentry.sln +++ b/Sentry.sln @@ -271,6 +271,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..1d941aa7a7 100644 --- a/integration-test/android.Tests.ps1 +++ b/integration-test/android.Tests.ps1 @@ -1,3 +1,7 @@ +param( + [string] $dotnet_version = "net10.0" +) + # This file contains test cases for https://pester.dev/ Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' @@ -12,11 +16,18 @@ 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 { + if ($dotnet_version -eq 'net9.0') { + $tfm = 'net9.0-android35.0' + } else { + $tfm = 'net10.0-android36.0' + } + 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 @@ -145,7 +156,8 @@ Describe 'MAUI app (, )' -ForEach @( $result.Envelopes() | Should -HaveCount 1 } - It 'Native crash ()' { + # Skipping on .NET 10.0 for the time being - see https://github.com/getsentry/sentry-dotnet/pull/4750#issuecomment-3583814252 + It 'Native crash ()' -Skip:($dotnet_version -eq 'net10.0') { $result = Invoke-SentryServer { param([string]$url) RunAndroidApp -Dsn $url -TestArg "Native" @@ -169,13 +181,8 @@ Describe 'MAUI app (, )' -ForEach @( Dump-ServerErrors -Result $result $result.HasErrors() | Should -BeFalse $result.Envelopes() | 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 - } else { - $result.Envelopes() | Should -Not -AnyElementMatch "`"type`":`"SIGSEGV`"" - $result.Envelopes() | Should -HaveCount 1 - } + $result.Envelopes() | Should -Not -AnyElementMatch "`"type`":`"SIGSEGV`"" + $result.Envelopes() | Should -HaveCount 1 } It 'Delivers battery breadcrumbs in main thread ()' { diff --git a/integration-test/net9-maui/Sentry.Maui.Device.IntegrationTestApp.csproj b/integration-test/net9-maui/Sentry.Maui.Device.IntegrationTestApp.csproj index ed6ab044f6..c998217f68 100644 --- a/integration-test/net9-maui/Sentry.Maui.Device.IntegrationTestApp.csproj +++ b/integration-test/net9-maui/Sentry.Maui.Device.IntegrationTestApp.csproj @@ -1,7 +1,7 @@ - $(TargetFrameworks);net9.0-android35.0 + $(TargetFrameworks);net9.0-android35.0;net10.0-android36.0 $(TargetFrameworks);net9.0-ios18.0 Exe 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..1a24ba8bab 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,8 @@  - $(TargetFrameworks);net9.0-android - $(TargetFrameworks);net9.0-ios + $(TargetFrameworks);net9.0-android;net10.0-android + $(TargetFrameworks);net9.0-ios;net10.0-ios $(DefineConstants);VISUAL_RUNNER @@ -75,6 +75,11 @@ + + + + +