From de50d84329580db29727a9b5433743820bdd6685 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 11 Nov 2026 11:57:29 +0100 Subject: [PATCH 1/4] Pass the event sample rate to sentry-cocoa Native iOS and macOS crashes now follow SampleRate with both runtime and build-time initialization. --- CHANGELOG.md | 1 + src/Sentry.Unity.Editor.iOS/NativeOptions.cs | 8 ++- .../SentryCocoaBridgeProxy.cs | 61 +++++++++++++------ .../NativeOptionsTests.cs | 38 ++++++++++++ .../SentryCocoaBridgeProxyTests.cs | 35 +++++++++++ 5 files changed, 122 insertions(+), 21 deletions(-) create mode 100644 test/Sentry.Unity.iOS.Tests/SentryCocoaBridgeProxyTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e4d0b96c..737e0a881 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixes +- On iOS and macOS, native crashes now respect the Event Sample Rate (`SampleRate`). Unity passes it to the Cocoa SDK with both runtime and build-time initialization, so native crashes are no longer always sent. ([#TBD](https://github.com/getsentry/sentry-unity/pull/TBD)) - The Event Sample Rate in the Sentry window now accepts values from 0.01 to 1.0. A rate of 0 made the SDK fail to initialize and builds fail to load the options. ([#2929](https://github.com/getsentry/sentry-unity/pull/2929)) - On iOS, development builds now respect `UploadDevelopmentSymbols` and no longer upload debug symbols unless it is enabled, matching the other platforms. ([#2928](https://github.com/getsentry/sentry-unity/pull/2928)) diff --git a/src/Sentry.Unity.Editor.iOS/NativeOptions.cs b/src/Sentry.Unity.Editor.iOS/NativeOptions.cs index 8522eeb12..374cf0724 100644 --- a/src/Sentry.Unity.Editor.iOS/NativeOptions.cs +++ b/src/Sentry.Unity.Editor.iOS/NativeOptions.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Globalization; using System.IO; namespace Sentry.Unity.Editor.iOS; @@ -33,7 +34,7 @@ internal static string Generate(SentryUnityOptions options) @""appHangTimeoutInterval"": @{options.AppHangTimeout.TotalSeconds.ToString(System.Globalization.CultureInfo.InvariantCulture)}, @""enableCaptureFailedRequests"": @{ToObjCString(options.CaptureFailedRequests)}, @""failedRequestStatusCodes"" : @[{failedRequestStatusCodesArray}], - @""sendDefaultPii"" : @{ToObjCString(options.SendDefaultPii)}, +{GetSampleRateEntry(options.SampleRate)} @""sendDefaultPii"" : @{ToObjCString(options.SendDefaultPii)}, @""attachScreenshot"" : @{ToObjCString(options.AttachScreenshot)}, @""release"" : @""{options.Release}"", @""environment"" : @""{options.Environment}"", @@ -60,6 +61,11 @@ internal static string Generate(SentryUnityOptions options) return nativeOptions; } + // The key is left out when no rate is set, so sentry-cocoa keeps its default of 1. + private static string GetSampleRateEntry(float? sampleRate) => sampleRate.HasValue + ? $" @\"sampleRate\" : @{sampleRate.Value.ToString(CultureInfo.InvariantCulture)},\n" + : string.Empty; + private static string ToObjCString(bool b) => b ? "YES" : "NO"; private static string ToNativeDiagnosticLevel(SentryLevel sentryLevel) diff --git a/src/Sentry.Unity.iOS/SentryCocoaBridgeProxy.cs b/src/Sentry.Unity.iOS/SentryCocoaBridgeProxy.cs index dced1a8ab..d4509ae4e 100644 --- a/src/Sentry.Unity.iOS/SentryCocoaBridgeProxy.cs +++ b/src/Sentry.Unity.iOS/SentryCocoaBridgeProxy.cs @@ -26,69 +26,90 @@ public static bool Init(SentryUnityOptions options) Logger = options.DiagnosticLogger; var cOptions = OptionsNew(); + WriteOptions(options, + (name, value) => OptionsSetString(cOptions, name, value), + (name, value) => OptionsSetInt(cOptions, name, value), + (name, value) => OptionsSetDouble(cOptions, name, value), + (min, max) => OptionsAddFailedRequestStatusCodeRange(cOptions, min, max)); + var result = StartWithOptions(cOptions); + return result is 1; + } + + /// + /// Writes the options sentry-cocoa reads from its options dictionary through the given setters. + /// + internal static void WriteOptions(SentryUnityOptions options, + Action setString, + Action setInt, + Action setDouble, + Action addFailedRequestStatusCodeRange) + { // Note: DSN is not null because options.IsValid() must have returned true for this to be called. - OptionsSetString(cOptions, "dsn", options.Dsn!); + setString("dsn", options.Dsn!); if (options.Release is not null) { Logger?.LogDebug("Setting Release: {0}", options.Release); - OptionsSetString(cOptions, "release", options.Release); + setString("release", options.Release); } if (options.Environment is not null) { Logger?.LogDebug("Setting Environment: {0}", options.Environment); - OptionsSetString(cOptions, "environment", options.Environment); + setString("environment", options.Environment); } Logger?.LogDebug("Setting Debug: {0}", options.Debug); - OptionsSetInt(cOptions, "debug", options.Debug ? 1 : 0); + setInt("debug", options.Debug ? 1 : 0); var diagnosticLevel = options.DiagnosticLevel.ToString().ToLowerInvariant(); Logger?.LogDebug("Setting DiagnosticLevel: {0}", diagnosticLevel); - OptionsSetString(cOptions, "diagnosticLevel", diagnosticLevel); + setString("diagnosticLevel", diagnosticLevel); + + if (options.SampleRate.HasValue) + { + Logger?.LogDebug("Setting SampleRate: {0}", options.SampleRate.Value); + setDouble("sampleRate", options.SampleRate.Value); + } Logger?.LogDebug("Setting SendDefaultPii: {0}", options.SendDefaultPii); - OptionsSetInt(cOptions, "sendDefaultPii", options.SendDefaultPii ? 1 : 0); + setInt("sendDefaultPii", options.SendDefaultPii ? 1 : 0); // macOS screenshots currently don't work, because there's no UIKit. Cocoa logs: "Sentry - info:: NO UIKit" // Logger?.LogDebug("Setting AttachScreenshot: {0}", options.AttachScreenshot); - // OptionsSetInt(cOptions, "attachScreenshot", options.AttachScreenshot ? 1 : 0); - OptionsSetInt(cOptions, "attachScreenshot", 0); + // setInt("attachScreenshot", options.AttachScreenshot ? 1 : 0); + setInt("attachScreenshot", 0); Logger?.LogDebug("Setting MaxBreadcrumbs: {0}", options.MaxBreadcrumbs); - OptionsSetInt(cOptions, "maxBreadcrumbs", options.MaxBreadcrumbs); + setInt("maxBreadcrumbs", options.MaxBreadcrumbs); Logger?.LogDebug("Setting MaxCacheItems: {0}", options.MaxCacheItems); - OptionsSetInt(cOptions, "maxCacheItems", options.MaxCacheItems); + setInt("maxCacheItems", options.MaxCacheItems); // See https://github.com/getsentry/sentry-unity/issues/1658 - OptionsSetInt(cOptions, "enableNetworkBreadcrumbs", 0); + setInt("enableNetworkBreadcrumbs", 0); Logger?.LogDebug("Setting EnableAppHangTracking: {0}", options.EnableAppHangTracking); - OptionsSetInt(cOptions, "enableAppHangTracking", options.EnableAppHangTracking ? 1 : 0); + setInt("enableAppHangTracking", options.EnableAppHangTracking ? 1 : 0); Logger?.LogDebug("Setting AppHangTimeoutInterval: {0}s", options.AppHangTimeout.TotalSeconds); - OptionsSetDouble(cOptions, "appHangTimeoutInterval", options.AppHangTimeout.TotalSeconds); + setDouble("appHangTimeoutInterval", options.AppHangTimeout.TotalSeconds); Logger?.LogDebug("Setting EnableWatchdogTerminationTracking: {0}", options.IosWatchdogTerminationIntegrationEnabled); - OptionsSetInt(cOptions, "enableWatchdogTerminationTracking", options.IosWatchdogTerminationIntegrationEnabled ? 1 : 0); + setInt("enableWatchdogTerminationTracking", options.IosWatchdogTerminationIntegrationEnabled ? 1 : 0); Logger?.LogDebug("Setting CaptureFailedRequests: {0}", options.CaptureFailedRequests); - OptionsSetInt(cOptions, "enableCaptureFailedRequests", options.CaptureFailedRequests ? 1 : 0); + setInt("enableCaptureFailedRequests", options.CaptureFailedRequests ? 1 : 0); Logger?.LogDebug("Setting EnableLogs: {0}", options.EnableLogs); - OptionsSetInt(cOptions, "enableLogs", options.EnableLogs ? 1 : 0); + setInt("enableLogs", options.EnableLogs ? 1 : 0); foreach (var range in options.FailedRequestStatusCodes) { Logger?.LogDebug("Adding FailedRequestStatusCodeRange: {0}-{1}", range.Start, range.End); - OptionsAddFailedRequestStatusCodeRange(cOptions, range.Start, range.End); + addFailedRequestStatusCodeRange(range.Start, range.End); } - - var result = StartWithOptions(cOptions); - return result is 1; } [DllImport("__Internal", EntryPoint = "SentryNativeBridgeLoadLibrary")] diff --git a/test/Sentry.Unity.Editor.iOS.Tests/NativeOptionsTests.cs b/test/Sentry.Unity.Editor.iOS.Tests/NativeOptionsTests.cs index fea49a8b1..aa55e5ff2 100644 --- a/test/Sentry.Unity.Editor.iOS.Tests/NativeOptionsTests.cs +++ b/test/Sentry.Unity.Editor.iOS.Tests/NativeOptionsTests.cs @@ -1,4 +1,5 @@ using System; +using System.Globalization; using System.IO; using NUnit.Framework; @@ -110,4 +111,41 @@ public void CreateOptionsFile_FilterBadGatewayDisabled_DoesNotAddFiltering() var nativeOptions = File.ReadAllText(_testOptionsFilePath); StringAssert.DoesNotContain("event.request.url containsString:@\"operate-sdk-telemetry.unity3d.com\"", nativeOptions); } + + [Test] + public void CreateOptionsFile_SampleRateSet_WritesSampleRate() + { + NativeOptions.CreateFile(_testOptionsFilePath, new SentryUnityOptions { SampleRate = 0.3f }); + + var nativeOptions = File.ReadAllText(_testOptionsFilePath); + StringAssert.Contains("@\"sampleRate\" : @0.3,", nativeOptions); + } + + [Test] + public void CreateOptionsFile_SampleRateSetUnderCommaDecimalCulture_WritesInvariantSampleRate() + { + var originalCulture = CultureInfo.CurrentCulture; + try + { + CultureInfo.CurrentCulture = new CultureInfo("de-DE"); + + NativeOptions.CreateFile(_testOptionsFilePath, new SentryUnityOptions { SampleRate = 0.3f }); + } + finally + { + CultureInfo.CurrentCulture = originalCulture; + } + + var nativeOptions = File.ReadAllText(_testOptionsFilePath); + StringAssert.Contains("@\"sampleRate\" : @0.3,", nativeOptions); + } + + [Test] + public void CreateOptionsFile_SampleRateNotSet_LeavesSampleRateOut() + { + NativeOptions.CreateFile(_testOptionsFilePath, new SentryUnityOptions { SampleRate = null }); + + var nativeOptions = File.ReadAllText(_testOptionsFilePath); + StringAssert.DoesNotContain("sampleRate", nativeOptions); + } } diff --git a/test/Sentry.Unity.iOS.Tests/SentryCocoaBridgeProxyTests.cs b/test/Sentry.Unity.iOS.Tests/SentryCocoaBridgeProxyTests.cs new file mode 100644 index 000000000..a34c0f464 --- /dev/null +++ b/test/Sentry.Unity.iOS.Tests/SentryCocoaBridgeProxyTests.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using NUnit.Framework; + +namespace Sentry.Unity.iOS.Tests; + +public class SentryCocoaBridgeProxyTests +{ + private static Dictionary WriteOptions(SentryUnityOptions options) + { + var written = new Dictionary(); + SentryCocoaBridgeProxy.WriteOptions(options, + (name, value) => written[name] = value, + (name, value) => written[name] = value, + (name, value) => written[name] = value, + (_, _) => { }); + return written; + } + + [Test] + public void WriteOptions_SampleRateSet_SetsSampleRate() + { + var written = WriteOptions(new SentryUnityOptions { Dsn = "https://key@sentry.io/1", SampleRate = 0.25f }); + + Assert.IsTrue(written.ContainsKey("sampleRate")); + Assert.AreEqual(0.25, (double)written["sampleRate"]); + } + + [Test] + public void WriteOptions_SampleRateNotSet_LeavesSampleRateOut() + { + var written = WriteOptions(new SentryUnityOptions { Dsn = "https://key@sentry.io/1", SampleRate = null }); + + Assert.IsFalse(written.ContainsKey("sampleRate")); + } +} From f4bec2ee7b4ce58a272eee7f52194ef269792927 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 11 Nov 2026 12:01:05 +0100 Subject: [PATCH 2/4] Write the sample rate on its own line in the generated options --- src/Sentry.Unity.Editor.iOS/NativeOptions.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Sentry.Unity.Editor.iOS/NativeOptions.cs b/src/Sentry.Unity.Editor.iOS/NativeOptions.cs index 374cf0724..f68857c23 100644 --- a/src/Sentry.Unity.Editor.iOS/NativeOptions.cs +++ b/src/Sentry.Unity.Editor.iOS/NativeOptions.cs @@ -34,7 +34,8 @@ internal static string Generate(SentryUnityOptions options) @""appHangTimeoutInterval"": @{options.AppHangTimeout.TotalSeconds.ToString(System.Globalization.CultureInfo.InvariantCulture)}, @""enableCaptureFailedRequests"": @{ToObjCString(options.CaptureFailedRequests)}, @""failedRequestStatusCodes"" : @[{failedRequestStatusCodesArray}], -{GetSampleRateEntry(options.SampleRate)} @""sendDefaultPii"" : @{ToObjCString(options.SendDefaultPii)}, + {GetSampleRateEntry(options.SampleRate)} + @""sendDefaultPii"" : @{ToObjCString(options.SendDefaultPii)}, @""attachScreenshot"" : @{ToObjCString(options.AttachScreenshot)}, @""release"" : @""{options.Release}"", @""environment"" : @""{options.Environment}"", @@ -63,7 +64,7 @@ internal static string Generate(SentryUnityOptions options) // The key is left out when no rate is set, so sentry-cocoa keeps its default of 1. private static string GetSampleRateEntry(float? sampleRate) => sampleRate.HasValue - ? $" @\"sampleRate\" : @{sampleRate.Value.ToString(CultureInfo.InvariantCulture)},\n" + ? $"@\"sampleRate\" : @{sampleRate.Value.ToString(CultureInfo.InvariantCulture)}," : string.Empty; private static string ToObjCString(bool b) => b ? "YES" : "NO"; From eae06c3962b17f9b925f41f37123345c82b438e0 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 11 Nov 2026 13:05:15 +0100 Subject: [PATCH 3/4] Link the CHANGELOG entry to #2940 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 737e0a881..9810ca951 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Fixes -- On iOS and macOS, native crashes now respect the Event Sample Rate (`SampleRate`). Unity passes it to the Cocoa SDK with both runtime and build-time initialization, so native crashes are no longer always sent. ([#TBD](https://github.com/getsentry/sentry-unity/pull/TBD)) +- On iOS and macOS, native crashes now respect the Event Sample Rate (`SampleRate`). Unity passes it to the Cocoa SDK with both runtime and build-time initialization, so native crashes are no longer always sent. ([#2940](https://github.com/getsentry/sentry-unity/pull/2940)) - The Event Sample Rate in the Sentry window now accepts values from 0.01 to 1.0. A rate of 0 made the SDK fail to initialize and builds fail to load the options. ([#2929](https://github.com/getsentry/sentry-unity/pull/2929)) - On iOS, development builds now respect `UploadDevelopmentSymbols` and no longer upload debug symbols unless it is enabled, matching the other platforms. ([#2928](https://github.com/getsentry/sentry-unity/pull/2928)) From a615022f219e5d20e334d47c375855c554e6791b Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 11 Nov 2026 13:29:41 +0100 Subject: [PATCH 4/4] Set the sample rate directly in the Cocoa bridge's Init Drops the setter seam and its runtime tests; Init sets sampleRate the way Android and Native set theirs. --- src/Sentry.Unity.Editor.iOS/NativeOptions.cs | 2 +- .../SentryCocoaBridgeProxy.cs | 57 +++++++------------ .../SentryCocoaBridgeProxyTests.cs | 35 ------------ 3 files changed, 22 insertions(+), 72 deletions(-) delete mode 100644 test/Sentry.Unity.iOS.Tests/SentryCocoaBridgeProxyTests.cs diff --git a/src/Sentry.Unity.Editor.iOS/NativeOptions.cs b/src/Sentry.Unity.Editor.iOS/NativeOptions.cs index f68857c23..e40150977 100644 --- a/src/Sentry.Unity.Editor.iOS/NativeOptions.cs +++ b/src/Sentry.Unity.Editor.iOS/NativeOptions.cs @@ -62,7 +62,7 @@ internal static string Generate(SentryUnityOptions options) return nativeOptions; } - // The key is left out when no rate is set, so sentry-cocoa keeps its default of 1. + // SampleRate is null at a rate of 1.0. Leaving the key out keeps sentry-cocoa's default, which is also 1.0. private static string GetSampleRateEntry(float? sampleRate) => sampleRate.HasValue ? $"@\"sampleRate\" : @{sampleRate.Value.ToString(CultureInfo.InvariantCulture)}," : string.Empty; diff --git a/src/Sentry.Unity.iOS/SentryCocoaBridgeProxy.cs b/src/Sentry.Unity.iOS/SentryCocoaBridgeProxy.cs index d4509ae4e..498f74966 100644 --- a/src/Sentry.Unity.iOS/SentryCocoaBridgeProxy.cs +++ b/src/Sentry.Unity.iOS/SentryCocoaBridgeProxy.cs @@ -26,90 +26,75 @@ public static bool Init(SentryUnityOptions options) Logger = options.DiagnosticLogger; var cOptions = OptionsNew(); - WriteOptions(options, - (name, value) => OptionsSetString(cOptions, name, value), - (name, value) => OptionsSetInt(cOptions, name, value), - (name, value) => OptionsSetDouble(cOptions, name, value), - (min, max) => OptionsAddFailedRequestStatusCodeRange(cOptions, min, max)); - var result = StartWithOptions(cOptions); - return result is 1; - } - - /// - /// Writes the options sentry-cocoa reads from its options dictionary through the given setters. - /// - internal static void WriteOptions(SentryUnityOptions options, - Action setString, - Action setInt, - Action setDouble, - Action addFailedRequestStatusCodeRange) - { // Note: DSN is not null because options.IsValid() must have returned true for this to be called. - setString("dsn", options.Dsn!); + OptionsSetString(cOptions, "dsn", options.Dsn!); if (options.Release is not null) { Logger?.LogDebug("Setting Release: {0}", options.Release); - setString("release", options.Release); + OptionsSetString(cOptions, "release", options.Release); } if (options.Environment is not null) { Logger?.LogDebug("Setting Environment: {0}", options.Environment); - setString("environment", options.Environment); + OptionsSetString(cOptions, "environment", options.Environment); } Logger?.LogDebug("Setting Debug: {0}", options.Debug); - setInt("debug", options.Debug ? 1 : 0); + OptionsSetInt(cOptions, "debug", options.Debug ? 1 : 0); var diagnosticLevel = options.DiagnosticLevel.ToString().ToLowerInvariant(); Logger?.LogDebug("Setting DiagnosticLevel: {0}", diagnosticLevel); - setString("diagnosticLevel", diagnosticLevel); + OptionsSetString(cOptions, "diagnosticLevel", diagnosticLevel); if (options.SampleRate.HasValue) { Logger?.LogDebug("Setting SampleRate: {0}", options.SampleRate.Value); - setDouble("sampleRate", options.SampleRate.Value); + OptionsSetDouble(cOptions, "sampleRate", options.SampleRate.Value); } Logger?.LogDebug("Setting SendDefaultPii: {0}", options.SendDefaultPii); - setInt("sendDefaultPii", options.SendDefaultPii ? 1 : 0); + OptionsSetInt(cOptions, "sendDefaultPii", options.SendDefaultPii ? 1 : 0); // macOS screenshots currently don't work, because there's no UIKit. Cocoa logs: "Sentry - info:: NO UIKit" // Logger?.LogDebug("Setting AttachScreenshot: {0}", options.AttachScreenshot); - // setInt("attachScreenshot", options.AttachScreenshot ? 1 : 0); - setInt("attachScreenshot", 0); + // OptionsSetInt(cOptions, "attachScreenshot", options.AttachScreenshot ? 1 : 0); + OptionsSetInt(cOptions, "attachScreenshot", 0); Logger?.LogDebug("Setting MaxBreadcrumbs: {0}", options.MaxBreadcrumbs); - setInt("maxBreadcrumbs", options.MaxBreadcrumbs); + OptionsSetInt(cOptions, "maxBreadcrumbs", options.MaxBreadcrumbs); Logger?.LogDebug("Setting MaxCacheItems: {0}", options.MaxCacheItems); - setInt("maxCacheItems", options.MaxCacheItems); + OptionsSetInt(cOptions, "maxCacheItems", options.MaxCacheItems); // See https://github.com/getsentry/sentry-unity/issues/1658 - setInt("enableNetworkBreadcrumbs", 0); + OptionsSetInt(cOptions, "enableNetworkBreadcrumbs", 0); Logger?.LogDebug("Setting EnableAppHangTracking: {0}", options.EnableAppHangTracking); - setInt("enableAppHangTracking", options.EnableAppHangTracking ? 1 : 0); + OptionsSetInt(cOptions, "enableAppHangTracking", options.EnableAppHangTracking ? 1 : 0); Logger?.LogDebug("Setting AppHangTimeoutInterval: {0}s", options.AppHangTimeout.TotalSeconds); - setDouble("appHangTimeoutInterval", options.AppHangTimeout.TotalSeconds); + OptionsSetDouble(cOptions, "appHangTimeoutInterval", options.AppHangTimeout.TotalSeconds); Logger?.LogDebug("Setting EnableWatchdogTerminationTracking: {0}", options.IosWatchdogTerminationIntegrationEnabled); - setInt("enableWatchdogTerminationTracking", options.IosWatchdogTerminationIntegrationEnabled ? 1 : 0); + OptionsSetInt(cOptions, "enableWatchdogTerminationTracking", options.IosWatchdogTerminationIntegrationEnabled ? 1 : 0); Logger?.LogDebug("Setting CaptureFailedRequests: {0}", options.CaptureFailedRequests); - setInt("enableCaptureFailedRequests", options.CaptureFailedRequests ? 1 : 0); + OptionsSetInt(cOptions, "enableCaptureFailedRequests", options.CaptureFailedRequests ? 1 : 0); Logger?.LogDebug("Setting EnableLogs: {0}", options.EnableLogs); - setInt("enableLogs", options.EnableLogs ? 1 : 0); + OptionsSetInt(cOptions, "enableLogs", options.EnableLogs ? 1 : 0); foreach (var range in options.FailedRequestStatusCodes) { Logger?.LogDebug("Adding FailedRequestStatusCodeRange: {0}-{1}", range.Start, range.End); - addFailedRequestStatusCodeRange(range.Start, range.End); + OptionsAddFailedRequestStatusCodeRange(cOptions, range.Start, range.End); } + + var result = StartWithOptions(cOptions); + return result is 1; } [DllImport("__Internal", EntryPoint = "SentryNativeBridgeLoadLibrary")] diff --git a/test/Sentry.Unity.iOS.Tests/SentryCocoaBridgeProxyTests.cs b/test/Sentry.Unity.iOS.Tests/SentryCocoaBridgeProxyTests.cs deleted file mode 100644 index a34c0f464..000000000 --- a/test/Sentry.Unity.iOS.Tests/SentryCocoaBridgeProxyTests.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections.Generic; -using NUnit.Framework; - -namespace Sentry.Unity.iOS.Tests; - -public class SentryCocoaBridgeProxyTests -{ - private static Dictionary WriteOptions(SentryUnityOptions options) - { - var written = new Dictionary(); - SentryCocoaBridgeProxy.WriteOptions(options, - (name, value) => written[name] = value, - (name, value) => written[name] = value, - (name, value) => written[name] = value, - (_, _) => { }); - return written; - } - - [Test] - public void WriteOptions_SampleRateSet_SetsSampleRate() - { - var written = WriteOptions(new SentryUnityOptions { Dsn = "https://key@sentry.io/1", SampleRate = 0.25f }); - - Assert.IsTrue(written.ContainsKey("sampleRate")); - Assert.AreEqual(0.25, (double)written["sampleRate"]); - } - - [Test] - public void WriteOptions_SampleRateNotSet_LeavesSampleRateOut() - { - var written = WriteOptions(new SentryUnityOptions { Dsn = "https://key@sentry.io/1", SampleRate = null }); - - Assert.IsFalse(written.ContainsKey("sampleRate")); - } -}