diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6abddf2c2..6a9698763 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -431,6 +431,23 @@ jobs:
with:
unity-version: ${{ matrix.unity-version }}
+ test-build-windows-x86:
+ # Unity still ships a 32-bit standalone player and it needs its own sentry-native build.
+ # One version, native backend only: x86 is on its way out and the x64 matrix already covers
+ # the version spread and the crashpad backend. The version is the first matrix entry rather
+ # than a literal, because `test-create` only builds what the matrix holds and Unity-bump PRs
+ # narrow it to the bumped version. The lists in create-unity-matrix.yml are oldest-first.
+ name: Build Windows x86 ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version[0] }} Integration Test
+ if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
+ needs: [test-create, create-unity-matrix]
+ secrets:
+ UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}
+ SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
+ SENTRY_TEST_DSN: ${{ secrets.SENTRY_TEST_DSN }}
+ uses: ./.github/workflows/test-build-windows-x86.yml
+ with:
+ unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version[0] }}
+
test-build-windows-mono:
# The Mono scripting backend resolves P/Invokes differently than IL2CPP, so it needs its own
# player. One version, default (Crashpad) backend only: the IL2CPP matrix already covers the
@@ -500,6 +517,20 @@ jobs:
platform: windows
backend: ${{ matrix.backend }}
+ test-run-windows-x86:
+ name: Run Windows x86 native ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version[0] }} Integration Test
+ if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
+ needs: [test-build-windows-x86, create-unity-matrix]
+ secrets:
+ SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
+ SENTRY_TEST_DSN: ${{ secrets.SENTRY_TEST_DSN }}
+ uses: ./.github/workflows/test-run-desktop.yml
+ with:
+ unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version[0] }}
+ platform: windows
+ architecture: x86
+ backend: native
+
test-run-windows-mono:
name: Run Windows Mono ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version[0] }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
diff --git a/.github/workflows/test-build-windows-x86.yml b/.github/workflows/test-build-windows-x86.yml
new file mode 100644
index 000000000..fac318d77
--- /dev/null
+++ b/.github/workflows/test-build-windows-x86.yml
@@ -0,0 +1,143 @@
+name: "Test: Build Windows x86"
+on:
+ workflow_call:
+ inputs:
+ unity-version:
+ required: true
+ type: string
+ secrets:
+ UNITY_LICENSE_SERVER_CONFIG:
+ required: true
+ SENTRY_AUTH_TOKEN:
+ required: true
+ SENTRY_TEST_DSN:
+ required: true
+
+defaults:
+ run:
+ shell: pwsh
+
+jobs:
+ build:
+ name: Windows x86 ${{ inputs.unity-version }}
+ runs-on: windows-latest
+ env:
+ UNITY_VERSION: ${{ inputs.unity-version }}
+ BUILD_PLATFORM: Windows-x86
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+
+ - name: Load env
+ id: env
+ run: |
+ $u = (Get-Content scripts/unity-versions.json -Raw | ConvertFrom-Json).'${{ env.UNITY_VERSION }}'
+ "unityVersion=$($u.version)" >> $env:GITHUB_OUTPUT
+ "unityChangeset=$($u.changeset)" >> $env:GITHUB_OUTPUT
+
+ - name: Setup Unity
+ uses: getsentry/setup-unity@61c0c0944851685b6c1225e940d1b1ab349e3aa3
+ with:
+ unity-version: ${{ steps.env.outputs.unityVersion }}
+ unity-version-changeset: ${{ steps.env.outputs.unityChangeset }}
+ unity-modules: windows-il2cpp
+
+ - name: Create Unity license config
+ run: |
+ New-Item -Path "C:/ProgramData/Unity/config/" -ItemType Directory -Force
+ Set-Content -Path "C:/ProgramData/Unity/config/services-config.json" -Value "$env:UNITY_LICENSE_SERVER_CONFIG"
+ env:
+ UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}
+
+ - name: Download IntegrationTest project
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+ with:
+ name: test-${{ env.UNITY_VERSION }}
+
+ - name: Extract project archive
+ run: tar -xvzf test-project.tar.gz
+
+ - name: Restore Unity Library cache
+ uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
+ with:
+ path: samples/IntegrationTest/Library
+ key: it-library-windows-x86-${{ env.UNITY_VERSION }}-${{ github.run_id }}
+ restore-keys: |
+ it-library-windows-x86-${{ env.UNITY_VERSION }}-
+
+ - name: Download UPM package
+ uses: ./.github/actions/wait-for-artifact
+ with:
+ name: package-release
+
+ - name: Extract UPM package
+ run: ./test/Scripts.Integration.Test/extract-package.ps1
+
+ - name: Add Sentry to the project
+ run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "$env:UNITY_PATH" -PackagePath "test-package-release"
+
+ - name: Download DependencyConflict package
+ uses: ./.github/actions/wait-for-artifact
+ with:
+ name: dependency-conflict-package
+ path: dependency-conflict-package
+
+ - name: Add DependencyConflict to the project
+ run: ./test/Scripts.Integration.Test/add-dependency-conflict.ps1 -PackagePath "dependency-conflict-package"
+
+ - name: Configure Sentry
+ run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -Platform Windows
+ env:
+ SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }}
+
+ # Native backend only. The point of this job is that a 32-bit player loads a 32-bit
+ # sentry-native at all; covering both backends here would double Unity licence usage
+ # for no extra signal. The x64 matrix still covers crashpad.
+ - name: Select the Native backend
+ run: |
+ $optionsPath = "samples/IntegrationTest/Assets/Scripts/IntegrationOptionsConfiguration.cs"
+ $content = Get-Content $optionsPath -Raw
+ $content = $content -replace 'WindowsBackend = WindowsBackend.Crashpad', 'WindowsBackend = WindowsBackend.Native'
+ Set-Content $optionsPath $content
+
+ - name: Build with Sentry SDK
+ run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Windows-x86 -UnityVersion "$env:UNITY_VERSION"
+ env:
+ SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
+
+ - name: Assert symbols and sources were uploaded
+ run: ./test/Scripts.Integration.Test/assert-symbol-upload.ps1 -LogPath unity.log
+
+ # We create tar explicitly because upload-artifact is slow for many files.
+ - name: Create archive
+ run: |
+ Remove-Item -Recurse -Force samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame -ErrorAction SilentlyContinue
+ Copy-Item unity.log samples/IntegrationTest/Build/ -ErrorAction SilentlyContinue
+ tar -cvzf test-app-desktop.tar.gz samples/IntegrationTest/Build
+
+ - name: Upload test app
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: testapp-desktop-compiled-${{ env.UNITY_VERSION }}-windows-x86-native
+ if-no-files-found: error
+ path: test-app-desktop.tar.gz
+ retention-days: 14
+
+ - name: Save Unity Library cache
+ if: github.ref == 'refs/heads/main'
+ uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
+ with:
+ path: samples/IntegrationTest/Library
+ key: it-library-windows-x86-${{ env.UNITY_VERSION }}-${{ github.run_id }}
+
+ - name: Upload IntegrationTest project on failure
+ if: ${{ failure() }}
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: failed-project-desktop-windows-x86-${{ env.UNITY_VERSION }}
+ path: |
+ samples/IntegrationTest
+ unity.log
+ !samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame
+ retention-days: 14
diff --git a/.github/workflows/test-run-desktop.yml b/.github/workflows/test-run-desktop.yml
index 381d52da3..4cf4f7e24 100644
--- a/.github/workflows/test-run-desktop.yml
+++ b/.github/workflows/test-run-desktop.yml
@@ -14,6 +14,11 @@ on:
type: string
default: ""
description: "macOS: native or cocoa. Windows: native or crashpad. Linux: native or breakpad."
+ architecture:
+ required: false
+ type: string
+ default: ""
+ description: "Only set for non-default architectures, e.g. x86 for the 32-bit Windows player."
scripting:
required: false
type: string
@@ -31,7 +36,7 @@ defaults:
jobs:
run:
- name: ${{ inputs.platform }}${{ inputs.scripting && format(' {0}', inputs.scripting) || '' }}${{ inputs.backend && format(' ({0})', inputs.backend) || '' }} ${{ inputs.unity-version }}
+ name: ${{ inputs.platform }}${{ inputs.architecture && format(' {0}', inputs.architecture) || '' }}${{ inputs.scripting && format(' {0}', inputs.scripting) || '' }}${{ inputs.backend && format(' ({0})', inputs.backend) || '' }} ${{ inputs.unity-version }}
runs-on: ${{ inputs.platform == 'linux' && 'ubuntu-latest' || inputs.platform == 'macos' && 'macos-latest' || 'windows-latest' }}
env:
SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }}
@@ -48,7 +53,7 @@ jobs:
- name: Download test app artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
- name: testapp-desktop-compiled-${{ inputs.unity-version }}-${{ inputs.platform }}${{ inputs.scripting && format('-{0}', inputs.scripting) || '' }}${{ inputs.backend && format('-{0}', inputs.backend) || '' }}
+ name: testapp-desktop-compiled-${{ inputs.unity-version }}-${{ inputs.platform }}${{ inputs.architecture && format('-{0}', inputs.architecture) || '' }}${{ inputs.scripting && format('-{0}', inputs.scripting) || '' }}${{ inputs.backend && format('-{0}', inputs.backend) || '' }}
- name: Extract test app
run: tar -xvzf test-app-desktop.tar.gz
@@ -97,7 +102,7 @@ jobs:
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
- name: testapp-desktop-logs-${{ inputs.platform }}${{ inputs.scripting && format('-{0}', inputs.scripting) || '' }}${{ inputs.backend && format('-{0}', inputs.backend) || '' }}-${{ inputs.unity-version }}
+ name: testapp-desktop-logs-${{ inputs.platform }}${{ inputs.architecture && format('-{0}', inputs.architecture) || '' }}${{ inputs.scripting && format('-{0}', inputs.scripting) || '' }}${{ inputs.backend && format('-{0}', inputs.backend) || '' }}-${{ inputs.unity-version }}
path: |
test/IntegrationTest/results/
retention-days: 14
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1fc710007..898099694 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+### Fixes
+
+- Native crash capture now works on 32-bit Windows standalone builds. The SDK shipped only an x64 library while enabling native support for both architectures, so the player failed to load it. The P/Invokes into `sentry-native` also declare `Cdecl` now - without it the 32-bit player corrupted its stack on the first call. ([#2847](https://github.com/getsentry/sentry-unity/pull/2847))
+
### Dependencies
- Bump Native SDK from v0.16.6 to v0.17.0 ([#2862](https://github.com/getsentry/sentry-unity/pull/2862))
diff --git a/build/native-sdks.targets b/build/native-sdks.targets
index ca6b954aa..c095e81b3 100644
--- a/build/native-sdks.targets
+++ b/build/native-sdks.targets
@@ -124,83 +124,94 @@
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ build_$(SentryWindowsArch)
+ $(SentryWindowsArtifactsDestination)$(SentryWindowsArch)/
+
+
+
+
+
-
-
-
+
+
+
-
+
-
-
-
-
+
+
+
+
-
-
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ build_native_$(SentryWindowsArch)
+ $(SentryWindowsNativeArtifactsDestination)$(SentryWindowsArch)/
+
+
+
+
+
-
-
-
-
+
+
+
+
-
+
-
-
-
-
-
+
+
+
+
+
-
-
+
+
-
+