From cf448295ac0bc2d31f9550eff4d75ff21fe66c48 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 14 Jul 2025 10:57:08 +0200 Subject: [PATCH 01/12] wip: add linux-musl-arm64 job --- .github/workflows/build.yml | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4739f96a9f..ca5f73a50d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,6 +27,12 @@ jobs: rid: linux-musl-x64 container: image: ghcr.io/getsentry/sentry-dotnet-alpine:3.21 + - os: ubuntu-24.04-arm + rid: linux-musl-arm64 + container: + image: ghcr.io/jpnurmi/sentry-dotnet-alpine:3.21 # TODO: getsentry + volumes: + - /tmp/node20:/__e/node20 - os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703 rid: macos # universal (osx-arm64 + osx-x64) - os: windows-latest @@ -35,6 +41,16 @@ jobs: rid: win-arm64 steps: + ### TODO: clean up + - name: Prepare Node.js for non-x64 Alpine Linux + if: ${{ contains(matrix.container.image, 'alpine') && runner.arch != 'X64' }} + shell: bash + run: | + sudo mkdir -p /__e/node20/bin + sudo ln -sf /usr/bin/node /__e/node20/bin/node + sudo ln -sf /usr/bin/npm /__e/node20/bin/npm + sudo sed -i 's/ID=alpine/ID=unknown/' /usr/lib/os-release + - name: Checkout uses: actions/checkout@v4 @@ -83,6 +99,14 @@ jobs: image: ghcr.io/getsentry/sentry-dotnet-alpine:3.21 volumes: - /var/run/docker.sock:/var/run/docker.sock + - os: ubuntu-24.04-arm + rid: linux-musl-arm64 + slnf: Sentry-CI-Build-Linux-musl.slnf + container: + image: ghcr.io/jpnurmi/sentry-dotnet-alpine:3.21 # TODO: getsentry + volumes: + - /tmp/node20:/__e/node20 + - /var/run/docker.sock:/var/run/docker.sock - os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703 rid: macos # universal (osx-arm64 + osx-x64) slnf: Sentry-CI-Build-macOS.slnf @@ -94,6 +118,16 @@ jobs: slnf: Sentry-CI-Build-Windows-arm64.slnf steps: + ### TODO: clean up + - name: Prepare Node.js for non-x64 Alpine Linux + if: ${{ contains(matrix.container.image, 'alpine') && runner.arch != 'X64' }} + shell: bash + run: | + sudo mkdir -p /__e/node20/bin + sudo ln -sf /usr/bin/node /__e/node20/bin/node + sudo ln -sf /usr/bin/npm /__e/node20/bin/npm + sudo sed -i 's/ID=alpine/ID=unknown/' /usr/lib/os-release + - name: Cancel Previous Runs if: github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # Tag: 0.12.1 @@ -140,6 +174,14 @@ jobs: key: sentry-native-linux-musl-x64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }} fail-on-cache-miss: true + - name: Download sentry-native (linux-musl-arm64) + if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.rid == 'linux-musl-arm64') }} + uses: actions/cache/restore@v4 + with: + path: src/Sentry/Platforms/Native/sentry-native + key: sentry-native-linux-musl-arm64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }} + fail-on-cache-miss: true + - name: Download sentry-native (macos) if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.rid == 'macos') }} uses: actions/cache/restore@v4 From 4bb4f01d3f4d09171ed54f31ad0f48accfbcf4e1 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 17 Jul 2025 13:12:47 +0200 Subject: [PATCH 02/12] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87521074ab..9d3a5ea824 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Native AOT: don't load SentryNative on unsupported platforms ([#4347](https://github.com/getsentry/sentry-dotnet/pull/4347)) - Fixed issue introduced in release 5.12.0 that might prevent other middleware or user code from reading request bodies ([#4373](https://github.com/getsentry/sentry-dotnet/pull/4373)) +- Native AOT support for `linux-musl-arm64` ([#4365](https://github.com/getsentry/sentry-dotnet/pull/4365)) ### Dependencies From 90eaffd30f6b52b191f17592a2d6b0dcb7c31b46 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 17 Jul 2025 13:49:02 +0200 Subject: [PATCH 03/12] test: update integration tests Note: [System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier is available on .NET 5+ but these Native AOT integration tests are only relevant for .NET 7+ when Native AOT was introduced. --- integration-test/runtime.Tests.ps1 | 34 +++--------------------------- scripts/build-sentry-native.ps1 | 23 ++------------------ 2 files changed, 5 insertions(+), 52 deletions(-) diff --git a/integration-test/runtime.Tests.ps1 b/integration-test/runtime.Tests.ps1 index c8a0a55e15..50a20a9492 100644 --- a/integration-test/runtime.Tests.ps1 +++ b/integration-test/runtime.Tests.ps1 @@ -42,37 +42,9 @@ internal class FakeTransport : ITransport function getConsoleAppPath() { - if ($IsMacOS) - { - $arch = $(uname -m) -eq 'arm64' ? 'arm64' : 'x64' - return "./console-app/bin/Release/$framework/osx-$arch/publish/console-app" - } - elseif ($IsWindows) - { - if ("Arm64".Equals([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString())) - { - return "./console-app/bin/Release/$framework/win-arm64/publish/console-app.exe" - } - else - { - return "./console-app/bin/Release/$framework/win-x64/publish/console-app.exe" - } - } - else - { - if ("Arm64".Equals([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString())) - { - return "./console-app/bin/Release/$framework/linux-arm64/publish/console-app" - } - elseif ((ldd --version 2>&1) -match 'musl') - { - return "./console-app/bin/Release/$framework/linux-musl-x64/publish/console-app" - } - else - { - return "./console-app/bin/Release/$framework/linux-x64/publish/console-app" - } - } + $rid = [System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier + $suffix = if ($IsWindows) { '.exe' } else { '' } + return "./console-app/bin/Release/$framework/$rid/publish/console-app$suffix" } function publishConsoleApp([bool]$SentryNative = $true) diff --git a/scripts/build-sentry-native.ps1 b/scripts/build-sentry-native.ps1 index 8e7361901d..8b112a43aa 100644 --- a/scripts/build-sentry-native.ps1 +++ b/scripts/build-sentry-native.ps1 @@ -25,30 +25,11 @@ try $actualBuildDir = "$buildDir/RelWithDebInfo" $libPrefix = '' $libExtension = '.lib' - - if ("Arm64".Equals([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString())) - { - $outDir += '/win-arm64' - } - else - { - $outDir += '/win-x64' - } + $outDir += '/' + [System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier } elseif ($IsLinux) { - if ("Arm64".Equals([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString())) - { - $outDir += '/linux-arm64' - } - elseif ((ldd --version 2>&1) -match 'musl') - { - $outDir += '/linux-musl-x64' - } - else - { - $outDir += '/linux-x64' - } + $outDir += '/' + [System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier } else { From f0729094172b9b4efc9306447b8f6cd46eb69e0b Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 17 Jul 2025 14:08:17 +0200 Subject: [PATCH 04/12] build system: add linux-musl-arm64 --- src/Sentry/Platforms/Native/Sentry.Native.targets | 10 ++++++++++ .../Native/buildTransitive/Sentry.Native.targets | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Sentry/Platforms/Native/Sentry.Native.targets b/src/Sentry/Platforms/Native/Sentry.Native.targets index f425ac9b30..d79ec6e414 100644 --- a/src/Sentry/Platforms/Native/Sentry.Native.targets +++ b/src/Sentry/Platforms/Native/Sentry.Native.targets @@ -17,6 +17,8 @@ $(SentryNativeOutputDirectory)$(NativeLibRelativePath-linux-musl-x64)\ linux-arm64 $(SentryNativeOutputDirectory)$(NativeLibRelativePath-linux-arm64)\ + linux-musl-arm64 + $(SentryNativeOutputDirectory)$(NativeLibRelativePath-linux-musl-arm64)\ osx $(SentryNativeOutputDirectory)$(NativeLibRelativePath-osx)\ $(SentryNativeOutputDirectory-win-x64)lib$(SentryNativeLibraryName).lib @@ -24,6 +26,7 @@ $(SentryNativeOutputDirectory-linux-x64)lib$(SentryNativeLibraryName).a $(SentryNativeOutputDirectory-linux-musl-x64)lib$(SentryNativeLibraryName).a $(SentryNativeOutputDirectory-linux-arm64)lib$(SentryNativeLibraryName).a + $(SentryNativeOutputDirectory-linux-musl-arm64)lib$(SentryNativeLibraryName).a $(SentryNativeOutputDirectory-osx)lib$(SentryNativeLibraryName).a @@ -69,6 +72,13 @@ + + + true + \sentry-native\$(NativeLibRelativePath-linux-musl-arm64) + + + true diff --git a/src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets b/src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets index f2292d9a2c..bf19cfdd7a 100644 --- a/src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets +++ b/src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets @@ -52,11 +52,11 @@ - + - + From 6e9336793689c1bad58b45556af9e9bc4749ad66 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 17 Jul 2025 14:39:58 +0200 Subject: [PATCH 05/12] fix non-portable rids --- integration-test/runtime.Tests.ps1 | 40 +++++++++++++++++++++++++++--- scripts/build-sentry-native.ps1 | 29 ++++++++++++++++++++-- 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/integration-test/runtime.Tests.ps1 b/integration-test/runtime.Tests.ps1 index 50a20a9492..158890edc3 100644 --- a/integration-test/runtime.Tests.ps1 +++ b/integration-test/runtime.Tests.ps1 @@ -42,9 +42,43 @@ internal class FakeTransport : ITransport function getConsoleAppPath() { - $rid = [System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier - $suffix = if ($IsWindows) { '.exe' } else { '' } - return "./console-app/bin/Release/$framework/$rid/publish/console-app$suffix" + if ($IsMacOS) + { + $arch = $(uname -m) -eq 'arm64' ? 'arm64' : 'x64' + return "./console-app/bin/Release/$framework/osx-$arch/publish/console-app" + } + elseif ($IsWindows) + { + if ("Arm64".Equals([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString())) + { + return "./console-app/bin/Release/$framework/win-arm64/publish/console-app.exe" + } + else + { + return "./console-app/bin/Release/$framework/win-x64/publish/console-app.exe" + } + } + else + { + $musl = (ldd --version 2>&1) -match 'musl' + $arm64 = "Arm64".Equals([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString()) + if ($musl -and $arm64) + { + return "./console-app/bin/Release/$framework/linux-musl-arm64/publish/console-app" + } + elseif ($arm64) + { + return "./console-app/bin/Release/$framework/linux-arm64/publish/console-app" + } + elseif ($musl) + { + return "./console-app/bin/Release/$framework/linux-musl-x64/publish/console-app" + } + else + { + return "./console-app/bin/Release/$framework/linux-x64/publish/console-app" + } + } } function publishConsoleApp([bool]$SentryNative = $true) diff --git a/scripts/build-sentry-native.ps1 b/scripts/build-sentry-native.ps1 index 8b112a43aa..8917b66349 100644 --- a/scripts/build-sentry-native.ps1 +++ b/scripts/build-sentry-native.ps1 @@ -25,11 +25,36 @@ try $actualBuildDir = "$buildDir/RelWithDebInfo" $libPrefix = '' $libExtension = '.lib' - $outDir += '/' + [System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier + + if ("Arm64".Equals([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString())) + { + $outDir += '/win-arm64' + } + else + { + $outDir += '/win-x64' + } } elseif ($IsLinux) { - $outDir += '/' + [System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier + $musl = (ldd --version 2>&1) -match 'musl' + $arm64 = ("Arm64".Equals([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString())) + if ($musl -and $arm64) + { + $outDir += '/linux-musl-arm64' + } + elseif ($arm64) + { + $outDir += '/linux-arm64' + } + elseif ($musl) + { + $outDir += '/linux-musl-x64' + } + else + { + $outDir += '/linux-x64' + } } else { From b61409d17dc89dfa1753e110bec6e0399246c5d1 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 17 Jul 2025 19:31:58 +0000 Subject: [PATCH 06/12] VaListX64 vs. VaListArm64 --- src/Sentry/Platforms/Native/CFunctions.cs | 54 +++++++++++++++++------ 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/src/Sentry/Platforms/Native/CFunctions.cs b/src/Sentry/Platforms/Native/CFunctions.cs index 3d87e5d009..308ee8b7f1 100644 --- a/src/Sentry/Platforms/Native/CFunctions.cs +++ b/src/Sentry/Platforms/Native/CFunctions.cs @@ -82,6 +82,8 @@ internal static void SetValueIfNotNull(sentry_value_t obj, string key, double? v public static bool Init(SentryOptions options) { _isWindows = System.OperatingSystem.IsWindows(); + _isArm64 = RuntimeInformation.OSArchitecture == Architecture.Arm64; + var cOptions = sentry_options_new(); // Note: DSN is not null because options.IsValid() must have returned true for this to be called. @@ -442,6 +444,7 @@ private static void nativeTransportFree(IntPtr state) // The logger we should forward native messages to. This is referenced by nativeLog() which in turn for. private static IDiagnosticLogger? _logger; private static bool _isWindows = false; + private static bool _isArm64 = false; // This method is called from the C library and forwards incoming messages to the currently set _logger. // [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })] // error CS3016: Arrays as attribute arguments is not CLS-complian @@ -495,21 +498,14 @@ private static void nativeLogImpl(int cLevel, IntPtr format, IntPtr args, IntPtr message = Marshal.PtrToStringAnsi(buffer); }); } + // For Linux/macOS, we must make a copy of the VaList to be able to pass it back... + else if (_isArm64) + { + message = FormatWithVaList(format, args); + } else { - // For Linux/macOS, we must make a copy of the VaList to be able to pass it back... - var argsStruct = Marshal.PtrToStructure(args); - var formattedLength = 0; - WithMarshalledStruct(argsStruct, argsPtr => - formattedLength = 1 + vsnprintf_linux(IntPtr.Zero, UIntPtr.Zero, format, argsPtr) - ); - - WithAllocatedPtr(formattedLength, buffer => - WithMarshalledStruct(argsStruct, argsPtr => - { - vsnprintf_linux(buffer, (UIntPtr)formattedLength, format, argsPtr); - message = Marshal.PtrToStringAnsi(buffer); - })); + message = FormatWithVaList(format, args); } } catch (Exception err) @@ -534,7 +530,7 @@ private static void nativeLogImpl(int cLevel, IntPtr format, IntPtr args, IntPtr // https://stackoverflow.com/a/4958507/2386130 [StructLayout(LayoutKind.Sequential, Pack = 4)] - private struct VaListLinux64 + private struct VaListX64 { private uint _gp_offset; private uint _fp_offset; @@ -542,6 +538,17 @@ private struct VaListLinux64 private IntPtr _reg_save_area; } + // https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#definition-of-va-list + [StructLayout(LayoutKind.Sequential)] + private struct VaListArm64 + { + private IntPtr __stack; + private IntPtr __gr_top; + private IntPtr __vr_top; + private int __gr_offs; + private int __vr_offs; + } + private static void WithAllocatedPtr(int size, Action action) { var ptr = IntPtr.Zero; @@ -562,4 +569,23 @@ private static void WithMarshalledStruct(T structure, Action action) Marshal.StructureToPtr(structure, ptr, false); action(ptr); }); + + private static string? FormatWithVaList<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)] T>(IntPtr format, IntPtr args) where T : struct + { + string? message = null; + var argsStruct = Marshal.PtrToStructure(args); + var formattedLength = 0; + WithMarshalledStruct(argsStruct, argsPtr => + formattedLength = 1 + vsnprintf_linux(IntPtr.Zero, UIntPtr.Zero, format, argsPtr) + ); + + WithAllocatedPtr(formattedLength, buffer => + WithMarshalledStruct(argsStruct, argsPtr => + { + vsnprintf_linux(buffer, (UIntPtr)formattedLength, format, argsPtr); + message = Marshal.PtrToStringAnsi(buffer); + })); + + return message; + } } From 3216ca153d830b75927ea6c99836c845e7ba3f45 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 18 Jul 2025 13:49:52 +0200 Subject: [PATCH 07/12] whitelist linux-musl-arm64 --- .../Platforms/Native/buildTransitive/Sentry.Native.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets b/src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets index bf19cfdd7a..792acfc289 100644 --- a/src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets +++ b/src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets @@ -19,7 +19,7 @@ true - true + true true From 0aaaf9bcd162e4d3db9130773f042556a3558cbd Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 23 Jul 2025 13:44:27 +0200 Subject: [PATCH 08/12] switch to ghcr.io/getsentry/sentry-dotnet-alpine:3.21 --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ca5f73a50d..cee7e7318d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: - os: ubuntu-24.04-arm rid: linux-musl-arm64 container: - image: ghcr.io/jpnurmi/sentry-dotnet-alpine:3.21 # TODO: getsentry + image: ghcr.io/getsentry/sentry-dotnet-alpine:3.21 volumes: - /tmp/node20:/__e/node20 - os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703 @@ -103,7 +103,7 @@ jobs: rid: linux-musl-arm64 slnf: Sentry-CI-Build-Linux-musl.slnf container: - image: ghcr.io/jpnurmi/sentry-dotnet-alpine:3.21 # TODO: getsentry + image: ghcr.io/getsentry/sentry-dotnet-alpine:3.21 volumes: - /tmp/node20:/__e/node20 - /var/run/docker.sock:/var/run/docker.sock From 46f3953768d9280b743614803468d73465b2d050 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 24 Jul 2025 23:39:51 +0200 Subject: [PATCH 09/12] setup-node.sh --- .github/alpine/setup-node.sh | 12 ++++++++++++ .github/workflows/build.yml | 22 ++++++---------------- 2 files changed, 18 insertions(+), 16 deletions(-) create mode 100755 .github/alpine/setup-node.sh diff --git a/.github/alpine/setup-node.sh b/.github/alpine/setup-node.sh new file mode 100755 index 0000000000..bde0d9d300 --- /dev/null +++ b/.github/alpine/setup-node.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +[ -n "$1" ] || { echo "Usage: $0 "; exit 1; } + +# A workaround for "JavaScript Actions in Alpine containers are only supported on x64 Linux runners." +# https://github.com/actions/runner/blob/8a9b96806d12343f7d123c669e29c629138023dd/src/Runner.Worker/Handlers/StepHost.cs#L283-L290 +if [ "$(uname -m)" != "x86_64" ]; then + mkdir -p $1 + ln -s /usr/bin/node $1 + ln -s /usr/bin/npm $1 + sed -i 's/ID=alpine/ID=unknown/' /usr/lib/os-release +fi diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cee7e7318d..649fbec18f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,15 +41,10 @@ jobs: rid: win-arm64 steps: - ### TODO: clean up - - name: Prepare Node.js for non-x64 Alpine Linux - if: ${{ contains(matrix.container.image, 'alpine') && runner.arch != 'X64' }} - shell: bash + - name: Initialize Alpine Linux + if: ${{ contains(matrix.container.image, 'alpine') }} run: | - sudo mkdir -p /__e/node20/bin - sudo ln -sf /usr/bin/node /__e/node20/bin/node - sudo ln -sf /usr/bin/npm /__e/node20/bin/npm - sudo sed -i 's/ID=alpine/ID=unknown/' /usr/lib/os-release + curl -sSL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/.github/alpine/setup-node.sh | sudo bash /dev/stdin /__e/node20/bin/ - name: Checkout uses: actions/checkout@v4 @@ -118,15 +113,10 @@ jobs: slnf: Sentry-CI-Build-Windows-arm64.slnf steps: - ### TODO: clean up - - name: Prepare Node.js for non-x64 Alpine Linux - if: ${{ contains(matrix.container.image, 'alpine') && runner.arch != 'X64' }} - shell: bash + - name: Initialize Alpine Linux + if: ${{ contains(matrix.container.image, 'alpine') }} run: | - sudo mkdir -p /__e/node20/bin - sudo ln -sf /usr/bin/node /__e/node20/bin/node - sudo ln -sf /usr/bin/npm /__e/node20/bin/npm - sudo sed -i 's/ID=alpine/ID=unknown/' /usr/lib/os-release + curl -sSL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/.github/alpine/setup-node.sh | sudo bash /dev/stdin /__e/node20/bin/ - name: Cancel Previous Runs if: github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') From 9b798d2740e44aff39f2f6de5fd6146e537c40d4 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 25 Jul 2025 16:39:23 +0200 Subject: [PATCH 10/12] Update scripts/build-sentry-native.ps1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Stefan Pölz <38893694+Flash0ver@users.noreply.github.com> --- scripts/build-sentry-native.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-sentry-native.ps1 b/scripts/build-sentry-native.ps1 index 8917b66349..ee1d9a99ca 100644 --- a/scripts/build-sentry-native.ps1 +++ b/scripts/build-sentry-native.ps1 @@ -38,7 +38,7 @@ try elseif ($IsLinux) { $musl = (ldd --version 2>&1) -match 'musl' - $arm64 = ("Arm64".Equals([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString())) + $arm64 = "Arm64".Equals([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString()) if ($musl -and $arm64) { $outDir += '/linux-musl-arm64' From e83e71eb5cbd83bde7d18f441455d4bc23e30e75 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 25 Jul 2025 16:50:18 +0200 Subject: [PATCH 11/12] Try to make cursor happy --- src/Sentry/Platforms/Native/CFunctions.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Sentry/Platforms/Native/CFunctions.cs b/src/Sentry/Platforms/Native/CFunctions.cs index 308ee8b7f1..6aeb562ae4 100644 --- a/src/Sentry/Platforms/Native/CFunctions.cs +++ b/src/Sentry/Platforms/Native/CFunctions.cs @@ -81,9 +81,6 @@ internal static void SetValueIfNotNull(sentry_value_t obj, string key, double? v public static bool Init(SentryOptions options) { - _isWindows = System.OperatingSystem.IsWindows(); - _isArm64 = RuntimeInformation.OSArchitecture == Architecture.Arm64; - var cOptions = sentry_options_new(); // Note: DSN is not null because options.IsValid() must have returned true for this to be called. @@ -443,8 +440,9 @@ private static void nativeTransportFree(IntPtr state) // The logger we should forward native messages to. This is referenced by nativeLog() which in turn for. private static IDiagnosticLogger? _logger; - private static bool _isWindows = false; - private static bool _isArm64 = false; + private static bool _isWindows = System.OperatingSystem.IsWindows(); + private static bool _isLinux = System.OperatingSystem.IsLinux(); + private static bool _isArm64 = RuntimeInformation.OSArchitecture == Architecture.Arm64; // This method is called from the C library and forwards incoming messages to the currently set _logger. // [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })] // error CS3016: Arrays as attribute arguments is not CLS-complian @@ -499,7 +497,7 @@ private static void nativeLogImpl(int cLevel, IntPtr format, IntPtr args, IntPtr }); } // For Linux/macOS, we must make a copy of the VaList to be able to pass it back... - else if (_isArm64) + else if (_isLinux && _isArm64) { message = FormatWithVaList(format, args); } From c65f2575cb4e25be2c776bdcbd7b9e3c7d4bd021 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 25 Jul 2025 17:41:14 +0200 Subject: [PATCH 12/12] Drop _isLinux --- src/Sentry/Platforms/Native/CFunctions.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Sentry/Platforms/Native/CFunctions.cs b/src/Sentry/Platforms/Native/CFunctions.cs index 6aeb562ae4..582112fc4c 100644 --- a/src/Sentry/Platforms/Native/CFunctions.cs +++ b/src/Sentry/Platforms/Native/CFunctions.cs @@ -441,7 +441,6 @@ private static void nativeTransportFree(IntPtr state) // The logger we should forward native messages to. This is referenced by nativeLog() which in turn for. private static IDiagnosticLogger? _logger; private static bool _isWindows = System.OperatingSystem.IsWindows(); - private static bool _isLinux = System.OperatingSystem.IsLinux(); private static bool _isArm64 = RuntimeInformation.OSArchitecture == Architecture.Arm64; // This method is called from the C library and forwards incoming messages to the currently set _logger. @@ -497,7 +496,7 @@ private static void nativeLogImpl(int cLevel, IntPtr format, IntPtr args, IntPtr }); } // For Linux/macOS, we must make a copy of the VaList to be able to pass it back... - else if (_isLinux && _isArm64) + else if (_isArm64) { message = FormatWithVaList(format, args); }