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 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!;