Skip to content

Commit

Permalink
fix: hide StackTraceMode from options to avoid accidental errors when…
Browse files Browse the repository at this point in the history
… used with IL2CPP
  • Loading branch information
vaind committed Oct 21, 2022
1 parent e852e03 commit 63c011c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ Log.LogMessage("Unity Version: " + version);
</Task>
</UsingTask>

<!-- Locate the TestRunner.dlls by filling the wildcard with the template version number. 3d is the default template -->
<!-- Locate the TestRunner.dlls by filling the wildcard with the template version number. 3d is the default template -->
<UsingTask TaskName="LocateTestRunner" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<UnityLibcache ParameterType="System.String" Required="true" />
Expand Down
8 changes: 6 additions & 2 deletions src/Sentry.Unity/SentryUnityOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ public sealed class SentryUnityOptions : SentryOptions
/// </remarks>
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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion test/Sentry.Unity.Tests/SentryUnityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public void AsyncStackTrace()
{
var options = new SentryUnityOptions();
options.AttachStacktrace = true;
options.StackTraceMode = StackTraceMode.Original;
var sut = new SentryStackTraceFactory(options);

IList<SentryStackFrame> framesSentry = null!;
Expand Down

0 comments on commit 63c011c

Please sign in to comment.