From 63c011c31dc0cb8fb87ffa324959ffef0b5938ef Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Fri, 21 Oct 2022 16:27:21 +0200 Subject: [PATCH 1/2] fix: hide StackTraceMode from options to avoid accidental errors when used with IL2CPP --- Directory.Build.targets | 2 +- src/Sentry.Unity/SentryUnityOptions.cs | 8 ++++++-- test/Sentry.Unity.Tests/SentryUnityTests.cs | 1 - 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index 25949d11b..4b4f0ec2e 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -396,7 +396,7 @@ Log.LogMessage("Unity Version: " + version); - + diff --git a/src/Sentry.Unity/SentryUnityOptions.cs b/src/Sentry.Unity/SentryUnityOptions.cs index c7cd6cb13..ae8eddade 100644 --- a/src/Sentry.Unity/SentryUnityOptions.cs +++ b/src/Sentry.Unity/SentryUnityOptions.cs @@ -116,6 +116,9 @@ public sealed class SentryUnityOptions : SentryOptions /// public bool Il2CppLineNumberSupportEnabled { get; set; } = true; + /// This option is hidden due to incompatibility between IL2CPP and Enhanced mode. + private new StackTraceMode StackTraceMode { get; set; } + // Initialized by native SDK binding code to set the User.ID in .NET (UnityEventProcessor). internal string? _defaultUserId; internal string? DefaultUserId @@ -175,8 +178,9 @@ internal SentryUnityOptions(SentryMonoBehaviour behaviour, IApplication applicat RequestBodyCompressionLevel = CompressionLevelWithAuto.NoCompression; InitCacheFlushTimeout = System.TimeSpan.Zero; - // Ben.Demystifer not compatible with IL2CPP - StackTraceMode = StackTraceMode.Original; + // Ben.Demystifer not compatible with IL2CPP. We could allow Enhanced in the future for Mono. + // See https://github.com/getsentry/sentry-unity/issues/675 + base.StackTraceMode = StackTraceMode.Original; IsEnvironmentUser = false; if (application.ProductName is string productName diff --git a/test/Sentry.Unity.Tests/SentryUnityTests.cs b/test/Sentry.Unity.Tests/SentryUnityTests.cs index 6999d6bac..845d129cb 100644 --- a/test/Sentry.Unity.Tests/SentryUnityTests.cs +++ b/test/Sentry.Unity.Tests/SentryUnityTests.cs @@ -23,7 +23,6 @@ public void AsyncStackTrace() { var options = new SentryUnityOptions(); options.AttachStacktrace = true; - options.StackTraceMode = StackTraceMode.Original; var sut = new SentryStackTraceFactory(options); IList framesSentry = null!; From f234d6f002fbab545c94275e659ec89ff06695c0 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos <6349682+vaind@users.noreply.github.com> Date: Mon, 24 Oct 2022 13:12:24 +0200 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a5b9831e..4942a7b4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Additional IL2CPP arguments get added only once ([#997](https://github.com/getsentry/sentry-unity/pull/997)) - Releasing temp render texture after capturing a screenshot ([#983](https://github.com/getsentry/sentry-unity/pull/983)) - Automatic screenshot mirroring on select devices. ([#1019](https://github.com/getsentry/sentry-unity/pull/1019)) +- Hide `StackTraceMode` from options to avoid accidental errors when used with IL2CPP ([#1033](https://github.com/getsentry/sentry-unity/pull/1033)) ### Features