sentry-unity
sentry-unity copied to clipboard
IL2CPP Android fails to capture message due to reflection
Environment
How do you use Sentry? sentry.io
Which version of the SDK? 0.17 -> latest
How did you install the package? (Git-URL, Assetstore) git url
Which version of Unity? 2020.3.18f1 -> LTS
Is this happening in Unity (editor) or on a player like Android, iOS, Windows? Android - IL2CPP
Steps to Reproduce
- Create an IL2CPP android build
- Attempt to capture warning message
SentrySdk.CaptureMessage(message, scope =>
{
scope.SetFingerprint(Guid.NewGuid().ToString());
scope.SetTag("bug_report", "true");
}, SentryLevel.Warning);
Expected Result
Event is captured
Actual Result
Unsupported internal call for IL2CPP:Assembly::GetManifestModuleInternal - "This icall is not supported by il2cpp."
2022/07/08 09:17:33.446 17198 17398 Info Unity Sentry: (Info) Capturing event.
2022/07/08 09:17:33.449 17198 17398 Info Unity Sentry: (Debug) Running main event processor on: Event ca3b5aca5bb84dae84e7100503ab7bc7
2022/07/08 09:17:33.450 17198 17398 Info Unity Sentry: (Debug) Creating SentryStackTrace. isCurrentStackTrace: True.
2022/07/08 09:17:33.503 17198 17398 Error Unity Sentry: (Error) An error occurred when capturing the event ca3b5aca5bb84dae84e7100503ab7bc7. System.NotSupportedException: /Applications/Unity/Hub/Editor/2020.3.18f1/Unity.app/Contents/il2cpp/libil2cpp/icalls/mscorlib/System.Reflection/Assembly.cpp(541) : Unsupported internal call for IL2CPP:Assembly::GetManifestModuleInternal - "This icall is not supported by il2cpp."
2022/07/08 09:17:33.503 17198 17398 Error Unity at System.Diagnostics.TypeNameHelper.ProcessType (System.Text.StringBuilder builder, System.Type type, System.Diagnostics.TypeNameHelper+DisplayNameOptions options) [0x00000] in <00000000000000000000000000000000>:0
2022/07/08 09:17:33.503 17198 17398 Error Unity at System.Diagnostics.TypeNameHelper.GetTypeDisplayName (System.Type type, System.Boolean fullName, System.Boolean includeGenericParameterNames) [0x00000] in <00000000000000000000000000000000>:0
2022/07/08 09:17:33.503 17198 17398 Error Unity at System.Func`2[T,TResult].Invoke (T arg) [0x00000] in <00000000000000000000000000000000>:0
2022/07/08 09:17:33.503 17198 17398 Error Unity at System.Linq.Enumerable+WhereSelectArrayIterator`2[TSource,TResult].MoveNext () [0x00000] in <00000000000000000000000000000000>:0
2022/07/08 09:17:33.503 17198 17398 Error Unity at
Any logs or screenshots
I realize now this can be turned off for IL2CPP in the SDK configuration, can work around for now
o.StackTraceMode = StackTraceMode.Enhanced;
o.AttachStacktrace = true;
Hey @jschieck! Can you give any more details about your SDK options setup? It's strange to see a path to the Unity installation in an Android log.
What do you mean with 0.17 -> latest? Latest is 0.20.1 right now.
To confirm:
o.StackTraceMode = StackTraceMode.Enhanced;
o.AttachStacktrace = true;
This setting caused the issue, right? WIth default values it didn't fail?
If that's the case, it makes more of a case to have some compiler flags in the .NET SDK we can compile out some options for Unity such as this one, and the StartupTime.Optimal
Hey @jschieck! Can you give any more details about your SDK options setup? It's strange to see a path to the Unity installation in an Android log. What do you mean with
0.17 -> latest? Latest is 0.20.1 right now.
@bitsandfoxes By 0.17 -> latest I mean it happens for all those versions
SentryUnity.Init(o =>
{
o.Dsn = "omitted";
o.Enabled = true;
o.CaptureInEditor = true;
o.Release = "a_version_number";
o.AutoSessionTracking = true;
o.AutoSessionTrackingInterval = TimeSpan.FromMinutes(10);
o.SendDefaultPii = true;
o.TracesSampleRate = 1.0;
o.StackTraceMode = StackTraceMode.Enhanced;
o.Debug = true;
o.DiagnosticLevel = SentryLevel.Debug;
o.AttachStacktrace = true; // wrapping this in #if !ENABLE_IL2CPP prevents the error
});
@bruno-garcia yes that's correct
related to #675 and #46 on StackTraceMode.Enhanced
how about we hide with a hack:
public class SentryUnityOptions
{
private new StackTraceMode StackTraceMode {get;set}
}
If one casts to to SentryOption it'll be there, but otherwise won't show up