Skip to content

Commit 4de7786

Browse files
authored
fix: hide StackTraceMode from options to avoid accidental errors when used with IL2CPP (#1033)
1 parent 2e621f2 commit 4de7786

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Additional IL2CPP arguments get added only once ([#997](https://github.com/getsentry/sentry-unity/pull/997))
88
- Releasing temp render texture after capturing a screenshot ([#983](https://github.com/getsentry/sentry-unity/pull/983))
99
- Automatic screenshot mirroring on select devices. ([#1019](https://github.com/getsentry/sentry-unity/pull/1019))
10+
- Hide `StackTraceMode` from options to avoid accidental errors when used with IL2CPP ([#1033](https://github.com/getsentry/sentry-unity/pull/1033))
1011

1112
### Features
1213

Directory.Build.targets

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ Log.LogMessage("Unity Version: " + version);
396396
</Task>
397397
</UsingTask>
398398

399-
<!-- Locate the TestRunner.dlls by filling the wildcard with the template version number. 3d is the default template -->
399+
<!-- Locate the TestRunner.dlls by filling the wildcard with the template version number. 3d is the default template -->
400400
<UsingTask TaskName="LocateTestRunner" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
401401
<ParameterGroup>
402402
<UnityLibcache ParameterType="System.String" Required="true" />

src/Sentry.Unity/SentryUnityOptions.cs

+6-2
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ public sealed class SentryUnityOptions : SentryOptions
116116
/// </remarks>
117117
public bool Il2CppLineNumberSupportEnabled { get; set; } = true;
118118

119+
/// This option is hidden due to incompatibility between IL2CPP and Enhanced mode.
120+
private new StackTraceMode StackTraceMode { get; set; }
121+
119122
// Initialized by native SDK binding code to set the User.ID in .NET (UnityEventProcessor).
120123
internal string? _defaultUserId;
121124
internal string? DefaultUserId
@@ -175,8 +178,9 @@ internal SentryUnityOptions(SentryMonoBehaviour behaviour, IApplication applicat
175178
RequestBodyCompressionLevel = CompressionLevelWithAuto.NoCompression;
176179
InitCacheFlushTimeout = System.TimeSpan.Zero;
177180

178-
// Ben.Demystifer not compatible with IL2CPP
179-
StackTraceMode = StackTraceMode.Original;
181+
// Ben.Demystifer not compatible with IL2CPP. We could allow Enhanced in the future for Mono.
182+
// See https://github.com/getsentry/sentry-unity/issues/675
183+
base.StackTraceMode = StackTraceMode.Original;
180184
IsEnvironmentUser = false;
181185

182186
if (application.ProductName is string productName

test/Sentry.Unity.Tests/SentryUnityTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public void AsyncStackTrace()
2323
{
2424
var options = new SentryUnityOptions();
2525
options.AttachStacktrace = true;
26-
options.StackTraceMode = StackTraceMode.Original;
2726
var sut = new SentryStackTraceFactory(options);
2827

2928
IList<SentryStackFrame> framesSentry = null!;

0 commit comments

Comments
 (0)