From 560c3e5a28df26d28a77d2f227ce3765285c57fd Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Mon, 6 Jul 2026 18:48:12 +0200 Subject: [PATCH 1/7] resolved bcl dependency workaround --- scripts/alias-assemblies.ps1 | 5 +---- src/Sentry.Unity/Sentry.Unity.csproj | 11 +++++++++++ test/Scripts.Tests/package-release.zip.snapshot | 8 -------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/alias-assemblies.ps1 b/scripts/alias-assemblies.ps1 index 8773c91b2..0a729ad02 100644 --- a/scripts/alias-assemblies.ps1 +++ b/scripts/alias-assemblies.ps1 @@ -2,8 +2,6 @@ # release script (repack.ps1) and by CI (build.yml, which runs it inside the Unity # docker container). # -# --assemblies-to-exclude: BCL assemblies Unity's unityaot profile already provides -# For more info see sentry-unity #2717, #1777). param( # Pass an empty string to skip either target. [string]$RuntimeDir = "package-dev/Runtime", @@ -18,8 +16,7 @@ $ErrorActionPreference = "Stop" if ($RuntimeDir) { & $AssemblyAlias --target-directory $RuntimeDir --internalize --prefix "Sentry." ` - --assemblies-to-alias "Microsoft*;System*" ` - --assemblies-to-exclude "System.Buffers;System.Memory;System.Numerics.Vectors;System.Threading.Tasks.Extensions" + --assemblies-to-alias "Microsoft*;System*" if ($LASTEXITCODE -ne 0) { throw "assemblyalias failed for '$RuntimeDir' (exit $LASTEXITCODE)" } } diff --git a/src/Sentry.Unity/Sentry.Unity.csproj b/src/Sentry.Unity/Sentry.Unity.csproj index 69022fda2..72ab7ba9a 100644 --- a/src/Sentry.Unity/Sentry.Unity.csproj +++ b/src/Sentry.Unity/Sentry.Unity.csproj @@ -5,6 +5,17 @@ true + + + + + + + + + + + diff --git a/test/Scripts.Tests/package-release.zip.snapshot b/test/Scripts.Tests/package-release.zip.snapshot index 2d3946f66..baddaa9c1 100644 --- a/test/Scripts.Tests/package-release.zip.snapshot +++ b/test/Scripts.Tests/package-release.zip.snapshot @@ -303,14 +303,6 @@ Runtime/SentryInitialization.cs Runtime/SentryInitialization.cs.meta Runtime/SentryUserFeedback.cs Runtime/SentryUserFeedback.cs.meta -Runtime/System.Buffers.dll -Runtime/System.Buffers.dll.meta -Runtime/System.Memory.dll -Runtime/System.Memory.dll.meta -Runtime/System.Numerics.Vectors.dll -Runtime/System.Numerics.Vectors.dll.meta -Runtime/System.Threading.Tasks.Extensions.dll -Runtime/System.Threading.Tasks.Extensions.dll.meta Samples~/unity-of-bugs/Scenes.meta Samples~/unity-of-bugs/Scripts.meta Samples~/unity-of-bugs/Scenes/1_BugFarm.unity From e605ae81308b0651a656d3be5e96970c302a37d8 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Mon, 6 Jul 2026 18:56:14 +0200 Subject: [PATCH 2/7] updated changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb825c26f..8521c53a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Fixes + +- Fixed an issue with the updated dependency resolution introduced in `4.6.0` where usage of the `Metrics` API would cause Unity to error with `The type 'ReadOnlySpan<>' is defined in an assembly that is not referenced`. ([#2754](https://github.com/getsentry/sentry-unity/pull/2754)) + ### Dependencies - Bump CLI from v3.5.1 to v3.6.0 ([#2741](https://github.com/getsentry/sentry-unity/pull/2741)) From cb7c7237cc88a394ea7477a2b363031fe5beabf0 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Tue, 7 Jul 2026 11:18:57 +0200 Subject: [PATCH 3/7] add logs and metrics to the integration test --- test/IntegrationTest/CommonTestCases.ps1 | 32 +++++++++++++++++++ .../IntegrationOptionsConfiguration.cs | 3 ++ .../Scripts/IntegrationTester.cs | 21 ++++++++++++ 3 files changed, 56 insertions(+) diff --git a/test/IntegrationTest/CommonTestCases.ps1 b/test/IntegrationTest/CommonTestCases.ps1 index 4940ef69c..a4446e750 100644 --- a/test/IntegrationTest/CommonTestCases.ps1 +++ b/test/IntegrationTest/CommonTestCases.ps1 @@ -45,6 +45,38 @@ $CommonTestCases = @( $SentryEvent.title | Should -Not -BeNullOrEmpty } } + @{ Name = "Captures structured log in sentry.io"; TestBlock = { + param($TestSetup, $TestType, $SentryEvent, $RunResult) + # IntegrationTester emits a structured log alongside every captured event, + # tagged with a unique telemetry id it also prints as a LOG_CAPTURED marker. + if ($TestType -eq "crash-capture") { + Set-ItResult -Skipped -Because "the native crash kills the process before the log batch flushes" + return + } + $line = $RunResult.Output | Where-Object { $_ -match "LOG_CAPTURED: (.+)" } | Select-Object -First 1 + $line | Should -Not -BeNullOrEmpty -Because "the app must emit a LOG_CAPTURED marker" + $telemetryId = ($line | Select-String -Pattern "LOG_CAPTURED: (.+)").Matches.Groups[1].Value.Trim() + + $logs = Get-SentryTestLog -AttributeName "test.telemetry_id" -AttributeValue $telemetryId + $logs | Should -Not -BeNullOrEmpty + } + } + @{ Name = "Captures metric in sentry.io"; TestBlock = { + param($TestSetup, $TestType, $SentryEvent, $RunResult) + # IntegrationTester emits a counter metric alongside every captured event, + # tagged with a unique telemetry id it also prints as a METRIC_CAPTURED marker. + if ($TestType -eq "crash-capture") { + Set-ItResult -Skipped -Because "the native crash kills the process before the metric batch flushes" + return + } + $line = $RunResult.Output | Where-Object { $_ -match "METRIC_CAPTURED: (.+)" } | Select-Object -First 1 + $line | Should -Not -BeNullOrEmpty -Because "the app must emit a METRIC_CAPTURED marker" + $telemetryId = ($line | Select-String -Pattern "METRIC_CAPTURED: (.+)").Matches.Groups[1].Value.Trim() + + $metrics = Get-SentryTestMetric -MetricName "test.integration.counter" -AttributeName "test.telemetry_id" -AttributeValue $telemetryId + $metrics | Should -Not -BeNullOrEmpty + } + } @{ Name = "Has correct release version"; TestBlock = { param($TestSetup, $TestType, $SentryEvent, $RunResult) $SentryEvent.release.version | Should -Be "sentry-unity-test@1.0.0" diff --git a/test/Scripts.Integration.Test/Scripts/IntegrationOptionsConfiguration.cs b/test/Scripts.Integration.Test/Scripts/IntegrationOptionsConfiguration.cs index f52dd4944..4e36b64c4 100644 --- a/test/Scripts.Integration.Test/Scripts/IntegrationOptionsConfiguration.cs +++ b/test/Scripts.Integration.Test/Scripts/IntegrationOptionsConfiguration.cs @@ -26,6 +26,9 @@ public override void Configure(SentryUnityOptions options) options.DiagnosticLogger = Logger.Instance; options.TracesSampleRate = 1.0d; + // Structured logs default off; metrics default on + options.EnableLogs = true; + // No custom HTTP handler -- events go to real sentry.io // Filtering test output from breadcrumbs diff --git a/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs b/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs index d86f91af8..3dc7698ce 100644 --- a/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs +++ b/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs @@ -128,9 +128,30 @@ private void AddIntegrationTestContext(string testType) }; }); + EmitLogAndMetric(testType); + SentrySdk.AddBreadcrumb("Context configuration finished"); } + // Emits a structured log and a metric alongside every captured event. Each carries a unique + // telemetry id so the test harness can look them up via the Sentry API independently of the + // event. The "LOG_CAPTURED"/"METRIC_CAPTURED" markers are parsed by CommonTestCases.ps1. + private void EmitLogAndMetric(string testType) + { + var telemetryId = Guid.NewGuid().ToString(); + + SentrySdk.Logger.LogInfo( + log => log.SetAttribute("test.telemetry_id", telemetryId), + "Integration test log"); + Logger.Log($"LOG_CAPTURED: {telemetryId}"); + + SentrySdk.Metrics.EmitCounter( + "test.integration.counter", + 1, + new Dictionary { ["test.telemetry_id"] = telemetryId }); + Logger.Log($"METRIC_CAPTURED: {telemetryId}"); + } + private IEnumerator MessageCapture() { AddIntegrationTestContext("message-capture"); From 2976651772c891a85b146eeff6780609e5730d87 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Tue, 7 Jul 2026 15:04:23 +0200 Subject: [PATCH 4/7] preserve metrics --- src/Sentry.Unity/AotHints.cs | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/Sentry.Unity/AotHints.cs diff --git a/src/Sentry.Unity/AotHints.cs b/src/Sentry.Unity/AotHints.cs new file mode 100644 index 000000000..4eb26ad5e --- /dev/null +++ b/src/Sentry.Unity/AotHints.cs @@ -0,0 +1,48 @@ +using System; +using UnityEngine.Scripting; + +namespace Sentry.Unity; + +/// +/// Forces IL2CPP to generate AOT code for the generic-virtual metric methods. +/// +/// +/// The metric API dispatches through SentryMetricEmitter.CaptureMetric<T>, a generic +/// virtual method. IL2CPP cannot infer which value-type arguments reach that vtable slot, so it +/// transpiles no code for them and any call throws ExecutionEngineException at runtime. +/// Referencing every supported value type from a statically reachable call site makes IL2CPP emit +/// the instantiations ahead of time. This follows Unity's documented +/// UsedOnlyForAOTCodeGeneration pattern - the method is never executed. +/// +[Preserve] +internal static class AotHints +{ + [Preserve] + public static void UsedOnlyForAOTCodeGeneration() + { + var metrics = Sentry.SentrySdk.Metrics; + + metrics.EmitCounter("", (byte)0); + metrics.EmitCounter("", (short)0); + metrics.EmitCounter("", 0); + metrics.EmitCounter("", 0L); + metrics.EmitCounter("", 0f); + metrics.EmitCounter("", 0d); + + metrics.EmitGauge("", (byte)0); + metrics.EmitGauge("", (short)0); + metrics.EmitGauge("", 0); + metrics.EmitGauge("", 0L); + metrics.EmitGauge("", 0f); + metrics.EmitGauge("", 0d); + + metrics.EmitDistribution("", (byte)0); + metrics.EmitDistribution("", (short)0); + metrics.EmitDistribution("", 0); + metrics.EmitDistribution("", 0L); + metrics.EmitDistribution("", 0f); + metrics.EmitDistribution("", 0d); + + throw new InvalidOperationException("This method is used for AOT code generation only. Do not call it at runtime."); + } +} From 238c519e049ae87745bc5cb15d9bfa42a0f3c8d8 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 8 Jul 2026 09:43:26 +0200 Subject: [PATCH 5/7] . --- .../Assets/Scripts/BugFarmButtons.cs | 11 ++++- samples/unity-of-bugs/Packages/manifest.json | 2 +- .../unity-of-bugs/Packages/packages-lock.json | 2 +- .../ProjectSettings/ProjectSettings.asset | 2 +- src/Sentry.Unity/AotHints.cs | 48 ------------------- src/Sentry.Unity/Sentry.Unity.csproj | 2 +- test/IntegrationTest/CommonTestCases.ps1 | 32 ------------- .../IntegrationOptionsConfiguration.cs | 2 +- .../Scripts/IntegrationTester.cs | 13 +++-- 9 files changed, 21 insertions(+), 93 deletions(-) delete mode 100644 src/Sentry.Unity/AotHints.cs diff --git a/samples/unity-of-bugs/Assets/Scripts/BugFarmButtons.cs b/samples/unity-of-bugs/Assets/Scripts/BugFarmButtons.cs index e0a3d072b..1471b99d1 100644 --- a/samples/unity-of-bugs/Assets/Scripts/BugFarmButtons.cs +++ b/samples/unity-of-bugs/Assets/Scripts/BugFarmButtons.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Runtime.CompilerServices; using Sentry.Unity; using UnityEngine; @@ -7,7 +8,15 @@ public class BugFarmButtons : MonoBehaviour { private void Awake() { - Debug.Log("The 🐛s awaken!"); + var telemetryId = Guid.NewGuid().ToString(); + SentrySdk.Logger.LogInfo( + log => log.SetAttribute("telemetry_id", telemetryId), + "The 🐛s awaken!"); + + SentrySdk.Metrics.EmitCounter( + "test.integration.counter", + 1, + new Dictionary { ["telemetry_id"] = telemetryId }); } private void Start() diff --git a/samples/unity-of-bugs/Packages/manifest.json b/samples/unity-of-bugs/Packages/manifest.json index 81c1669c4..c8bb9d022 100644 --- a/samples/unity-of-bugs/Packages/manifest.json +++ b/samples/unity-of-bugs/Packages/manifest.json @@ -3,7 +3,7 @@ "com.unity.burst": "1.8.25", "com.unity.collab-proxy": "2.9.3", "com.unity.feature.development": "1.0.1", - "com.unity.ide.rider": "3.0.31", + "com.unity.ide.rider": "3.0.40", "com.unity.ide.visualstudio": "2.0.23", "com.unity.ide.vscode": "1.2.5", "com.unity.mobile.android-logcat": "1.4.6", diff --git a/samples/unity-of-bugs/Packages/packages-lock.json b/samples/unity-of-bugs/Packages/packages-lock.json index c11814176..d0df42ff2 100644 --- a/samples/unity-of-bugs/Packages/packages-lock.json +++ b/samples/unity-of-bugs/Packages/packages-lock.json @@ -46,7 +46,7 @@ } }, "com.unity.ide.rider": { - "version": "3.0.31", + "version": "3.0.40", "depth": 0, "source": "registry", "dependencies": { diff --git a/samples/unity-of-bugs/ProjectSettings/ProjectSettings.asset b/samples/unity-of-bugs/ProjectSettings/ProjectSettings.asset index 5e068d9c7..c4a93faa0 100644 --- a/samples/unity-of-bugs/ProjectSettings/ProjectSettings.asset +++ b/samples/unity-of-bugs/ProjectSettings/ProjectSettings.asset @@ -76,7 +76,6 @@ PlayerSettings: androidMinimumWindowHeight: 300 androidFullscreenMode: 1 androidAutoRotationBehavior: 1 - androidPredictiveBackSupport: 1 defaultIsNativeResolution: 1 macRetinaSupport: 1 runInBackground: 1 @@ -826,6 +825,7 @@ PlayerSettings: PS4: 1 PS5: 1 Stadia: 1 + Standalone: 3 WebGL: 1 Windows Store Apps: 1 XboxOne: 1 diff --git a/src/Sentry.Unity/AotHints.cs b/src/Sentry.Unity/AotHints.cs deleted file mode 100644 index 4eb26ad5e..000000000 --- a/src/Sentry.Unity/AotHints.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using UnityEngine.Scripting; - -namespace Sentry.Unity; - -/// -/// Forces IL2CPP to generate AOT code for the generic-virtual metric methods. -/// -/// -/// The metric API dispatches through SentryMetricEmitter.CaptureMetric<T>, a generic -/// virtual method. IL2CPP cannot infer which value-type arguments reach that vtable slot, so it -/// transpiles no code for them and any call throws ExecutionEngineException at runtime. -/// Referencing every supported value type from a statically reachable call site makes IL2CPP emit -/// the instantiations ahead of time. This follows Unity's documented -/// UsedOnlyForAOTCodeGeneration pattern - the method is never executed. -/// -[Preserve] -internal static class AotHints -{ - [Preserve] - public static void UsedOnlyForAOTCodeGeneration() - { - var metrics = Sentry.SentrySdk.Metrics; - - metrics.EmitCounter("", (byte)0); - metrics.EmitCounter("", (short)0); - metrics.EmitCounter("", 0); - metrics.EmitCounter("", 0L); - metrics.EmitCounter("", 0f); - metrics.EmitCounter("", 0d); - - metrics.EmitGauge("", (byte)0); - metrics.EmitGauge("", (short)0); - metrics.EmitGauge("", 0); - metrics.EmitGauge("", 0L); - metrics.EmitGauge("", 0f); - metrics.EmitGauge("", 0d); - - metrics.EmitDistribution("", (byte)0); - metrics.EmitDistribution("", (short)0); - metrics.EmitDistribution("", 0); - metrics.EmitDistribution("", 0L); - metrics.EmitDistribution("", 0f); - metrics.EmitDistribution("", 0d); - - throw new InvalidOperationException("This method is used for AOT code generation only. Do not call it at runtime."); - } -} diff --git a/src/Sentry.Unity/Sentry.Unity.csproj b/src/Sentry.Unity/Sentry.Unity.csproj index 72ab7ba9a..23ee56f0a 100644 --- a/src/Sentry.Unity/Sentry.Unity.csproj +++ b/src/Sentry.Unity/Sentry.Unity.csproj @@ -6,7 +6,7 @@ - + diff --git a/test/IntegrationTest/CommonTestCases.ps1 b/test/IntegrationTest/CommonTestCases.ps1 index a4446e750..4940ef69c 100644 --- a/test/IntegrationTest/CommonTestCases.ps1 +++ b/test/IntegrationTest/CommonTestCases.ps1 @@ -45,38 +45,6 @@ $CommonTestCases = @( $SentryEvent.title | Should -Not -BeNullOrEmpty } } - @{ Name = "Captures structured log in sentry.io"; TestBlock = { - param($TestSetup, $TestType, $SentryEvent, $RunResult) - # IntegrationTester emits a structured log alongside every captured event, - # tagged with a unique telemetry id it also prints as a LOG_CAPTURED marker. - if ($TestType -eq "crash-capture") { - Set-ItResult -Skipped -Because "the native crash kills the process before the log batch flushes" - return - } - $line = $RunResult.Output | Where-Object { $_ -match "LOG_CAPTURED: (.+)" } | Select-Object -First 1 - $line | Should -Not -BeNullOrEmpty -Because "the app must emit a LOG_CAPTURED marker" - $telemetryId = ($line | Select-String -Pattern "LOG_CAPTURED: (.+)").Matches.Groups[1].Value.Trim() - - $logs = Get-SentryTestLog -AttributeName "test.telemetry_id" -AttributeValue $telemetryId - $logs | Should -Not -BeNullOrEmpty - } - } - @{ Name = "Captures metric in sentry.io"; TestBlock = { - param($TestSetup, $TestType, $SentryEvent, $RunResult) - # IntegrationTester emits a counter metric alongside every captured event, - # tagged with a unique telemetry id it also prints as a METRIC_CAPTURED marker. - if ($TestType -eq "crash-capture") { - Set-ItResult -Skipped -Because "the native crash kills the process before the metric batch flushes" - return - } - $line = $RunResult.Output | Where-Object { $_ -match "METRIC_CAPTURED: (.+)" } | Select-Object -First 1 - $line | Should -Not -BeNullOrEmpty -Because "the app must emit a METRIC_CAPTURED marker" - $telemetryId = ($line | Select-String -Pattern "METRIC_CAPTURED: (.+)").Matches.Groups[1].Value.Trim() - - $metrics = Get-SentryTestMetric -MetricName "test.integration.counter" -AttributeName "test.telemetry_id" -AttributeValue $telemetryId - $metrics | Should -Not -BeNullOrEmpty - } - } @{ Name = "Has correct release version"; TestBlock = { param($TestSetup, $TestType, $SentryEvent, $RunResult) $SentryEvent.release.version | Should -Be "sentry-unity-test@1.0.0" diff --git a/test/Scripts.Integration.Test/Scripts/IntegrationOptionsConfiguration.cs b/test/Scripts.Integration.Test/Scripts/IntegrationOptionsConfiguration.cs index 4e36b64c4..9ac81ea2c 100644 --- a/test/Scripts.Integration.Test/Scripts/IntegrationOptionsConfiguration.cs +++ b/test/Scripts.Integration.Test/Scripts/IntegrationOptionsConfiguration.cs @@ -26,8 +26,8 @@ public override void Configure(SentryUnityOptions options) options.DiagnosticLogger = Logger.Instance; options.TracesSampleRate = 1.0d; - // Structured logs default off; metrics default on options.EnableLogs = true; + options.EnableMetrics = true; // No custom HTTP handler -- events go to real sentry.io diff --git a/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs b/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs index 3dc7698ce..ff1527a30 100644 --- a/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs +++ b/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs @@ -128,33 +128,31 @@ private void AddIntegrationTestContext(string testType) }; }); - EmitLogAndMetric(testType); - SentrySdk.AddBreadcrumb("Context configuration finished"); } - // Emits a structured log and a metric alongside every captured event. Each carries a unique - // telemetry id so the test harness can look them up via the Sentry API independently of the - // event. The "LOG_CAPTURED"/"METRIC_CAPTURED" markers are parsed by CommonTestCases.ps1. private void EmitLogAndMetric(string testType) { + Logger.Log($"Emitting log and metric."); + var telemetryId = Guid.NewGuid().ToString(); SentrySdk.Logger.LogInfo( log => log.SetAttribute("test.telemetry_id", telemetryId), "Integration test log"); - Logger.Log($"LOG_CAPTURED: {telemetryId}"); SentrySdk.Metrics.EmitCounter( "test.integration.counter", 1, new Dictionary { ["test.telemetry_id"] = telemetryId }); - Logger.Log($"METRIC_CAPTURED: {telemetryId}"); + + Logger.Log($"Emitting log and metric finished."); } private IEnumerator MessageCapture() { AddIntegrationTestContext("message-capture"); + EmitLogAndMetric("message-capture"); var eventId = SentrySdk.CaptureMessage("Integration test message"); Logger.Log($"EVENT_CAPTURED: {eventId}"); @@ -165,6 +163,7 @@ private IEnumerator MessageCapture() private IEnumerator ExceptionCapture() { AddIntegrationTestContext("exception-capture"); + EmitLogAndMetric("exception-capture"); try { From feac0394d28b65d95d8a41181e6ad5deaeb25231 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 8 Jul 2026 10:52:12 +0200 Subject: [PATCH 6/7] exclude 2021 --- .github/workflows/create-unity-matrix.yml | 2 +- .../Scripts/IntegrationTester.cs | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-unity-matrix.yml b/.github/workflows/create-unity-matrix.yml index 5ade8e564..2e3939340 100644 --- a/.github/workflows/create-unity-matrix.yml +++ b/.github/workflows/create-unity-matrix.yml @@ -14,7 +14,7 @@ on: env: # Unity versions used in PRs - PR_UNITY_VERSIONS: '["2021.3", "6000.5"]' + PR_UNITY_VERSIONS: '["2021.3", "2022.3", "6000.0", "6000.3", "6000.5"]' # Unity versions used on main branch FULL_UNITY_VERSIONS: '["2021.3", "2022.3", "6000.0", "6000.3", "6000.5"]' diff --git a/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs b/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs index ff1527a30..de022ec49 100644 --- a/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs +++ b/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs @@ -133,7 +133,7 @@ private void AddIntegrationTestContext(string testType) private void EmitLogAndMetric(string testType) { - Logger.Log($"Emitting log and metric."); + Logger.Log($"Emitting structured log."); var telemetryId = Guid.NewGuid().ToString(); @@ -141,12 +141,18 @@ private void EmitLogAndMetric(string testType) log => log.SetAttribute("test.telemetry_id", telemetryId), "Integration test log"); + Logger.Log($"Emitting structured log finished."); + +#if UNITY_2022_1_OR_NEWER + Logger.Log($"Emitting metric."); + SentrySdk.Metrics.EmitCounter( "test.integration.counter", 1, new Dictionary { ["test.telemetry_id"] = telemetryId }); - Logger.Log($"Emitting log and metric finished."); + Logger.Log($"Emitting metric finished."); +#endif } private IEnumerator MessageCapture() From d140b73124dd5b5063be70db7dae9249e7b21963 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 8 Jul 2026 12:03:48 +0200 Subject: [PATCH 7/7] . --- .github/workflows/create-unity-matrix.yml | 2 +- src/Sentry.Unity/SentrySdk.Dotnet.cs | 9 +++++---- .../Scripts/IntegrationTester.cs | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/create-unity-matrix.yml b/.github/workflows/create-unity-matrix.yml index 2e3939340..5ade8e564 100644 --- a/.github/workflows/create-unity-matrix.yml +++ b/.github/workflows/create-unity-matrix.yml @@ -14,7 +14,7 @@ on: env: # Unity versions used in PRs - PR_UNITY_VERSIONS: '["2021.3", "2022.3", "6000.0", "6000.3", "6000.5"]' + PR_UNITY_VERSIONS: '["2021.3", "6000.5"]' # Unity versions used on main branch FULL_UNITY_VERSIONS: '["2021.3", "2022.3", "6000.0", "6000.3", "6000.5"]' diff --git a/src/Sentry.Unity/SentrySdk.Dotnet.cs b/src/Sentry.Unity/SentrySdk.Dotnet.cs index fb1af3561..5799cce8c 100644 --- a/src/Sentry.Unity/SentrySdk.Dotnet.cs +++ b/src/Sentry.Unity/SentrySdk.Dotnet.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Sentry.Infrastructure; using Sentry.Protocol.Envelopes; +using Sentry.Unity.Integrations; namespace Sentry.Unity; @@ -334,8 +335,8 @@ public static SentryId CaptureFeedback(SentryFeedback feedback, Action co /// An optional hint providing high-level context for the source of the event. /// The Id of the captured feedback. Returns when capture failed. /// - /// Capturing is asynchronous and non-blocking. The envelope is handed to a background worker. Non-success - /// results inform only on whether the capture succeeded or failed on the client, i.e. empty message, + /// Capturing is asynchronous and non-blocking. The envelope is handed to a background worker. Non-success + /// results inform only on whether the capture succeeded or failed on the client, i.e. empty message, /// disabled SDK, dropped by an event processor. /// [DebuggerStepThrough] @@ -367,8 +368,8 @@ public static SentryId CaptureFeedback(SentryFeedback feedback, Scope? scope = n /// An optional hint providing high-level context for the source of the event. /// The Id of the captured feedback. Returns when capture failed. /// - /// Capturing is asynchronous and non-blocking. The envelope is handed to a background worker. Non-success - /// results inform only on whether the capture succeeded or failed on the client, i.e. empty message, + /// Capturing is asynchronous and non-blocking. The envelope is handed to a background worker. Non-success + /// results inform only on whether the capture succeeded or failed on the client, i.e. empty message, /// disabled SDK, dropped by an event processor. /// [DebuggerStepThrough] diff --git a/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs b/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs index de022ec49..fe38471cb 100644 --- a/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs +++ b/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs @@ -144,6 +144,7 @@ private void EmitLogAndMetric(string testType) Logger.Log($"Emitting structured log finished."); #if UNITY_2022_1_OR_NEWER + // Unity needs to be newer than 2022 for its AOT to generate the code for the generic implementation Logger.Log($"Emitting metric."); SentrySdk.Metrics.EmitCounter(