sentry-unity icon indicating copy to clipboard operation
sentry-unity copied to clipboard

[IOS & Android] Missing IL2CPP Line Number Information

Open ernesernesto opened this issue 1 year ago • 24 comments

Environment

How do you use Sentry? Sentry SaaS (sentry.io)

Which version of the SDK? 1.2.0

How did you install the package? (Git-URL, Assetstore) Git-URL

Which version of Unity? 2021.3.24f1

Is this happening in Unity (editor) or on a player like Android, iOS, Windows? Issue happening on IOS and Android device

Steps to Reproduce

Trigger exception on device (iphone and android)

Expected Result

Actual c# line number should be shown on sentry page

Actual Result

No info on actual line number, only filename and function that is having the exception

Notes or comments

  • From unity build log, unity is invoking il2cpp with these arguments Invoking il2cpp with arguments: --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile="unityaot-macos" --cachedirectory=REDACTED --additional-cpp=REDACTED --additional-cpp=REDACTED --avoid-dynamic-library-copy --dont-deploy-baselib --profiler-report --emit-source-mapping --directory=REDACTED --generatedcppdir=REDACTED --stats-output-dir=REDACTED --convert-in-graph
  • Sentry CLI is run with these arguments "./sentry-cli-Darwin-universal" "upload-dif" "--il2cpp-mapping" "--include-sources" REDACTED
  • Symbols and sources uploaded, all this is done automatically by xcode / gradle build process
  • On IOS Bitcode is disabled
  • sentry properties defaults.org=REDACTED defaults.project=REDACTED auth.token=REDACTED dif.max_item_size=10485760 log.level=info

Any logs or screenshots

Settings for unity ios build settings unity_ios_settings

Settings for unity android build settings unity_android_settings

IL2CPP line numbers is ticked Screen Shot 2023-05-30 at 21 42 06

Upload symbols is ticked (Dev and Sources) Screen Shot 2023-05-30 at 21 42 00

Event on ios not showing correct line number exception_ios

Event on android not showing correct line number exception_android

Symbols uploaded on ios events symbols_uploaded_ios

Symbols uploaded on android events (this is weird since it's a different event id with the same root cause issues but when I clicked show detail window it's showing ios unity framework) Screen Shot 2023-05-30 at 22 46 39

Upload symbol log for ios ios_sentry-symbols-upload.log

Upload symbol log for android android_sentry-symbols-upload.log

I could also provide the event link via mail if the sentry team needs that

Thanks!

ernesernesto avatar May 30 '23 15:05 ernesernesto

Hey @ernesernesto. Thanks for the amazingly detailed issue. I'll take a look asap.

bitsandfoxes avatar May 30 '23 18:05 bitsandfoxes

The links to the issue would be helpful. Could you send it to [email protected]?

bitsandfoxes avatar May 31 '23 18:05 bitsandfoxes

@bitsandfoxes sent to your mail, thanks!

ernesernesto avatar Jun 01 '23 00:06 ernesernesto

@bitsandfoxes hello, any new info for this?

ernesernesto avatar Jun 02 '23 05:06 ernesernesto

Hey @ernesernesto. I can reproduce issues with the line numbers locally and we're actively looking into fixing that.

bitsandfoxes avatar Jun 02 '23 11:06 bitsandfoxes

@bitsandfoxes that's great to hear! what's the actual problem? Is there anything that I can do on my end (downgrading or disabling some settings in order for il2cpp line number to work), or I just need to wait for the fix to come in?

ernesernesto avatar Jun 02 '23 14:06 ernesernesto

I'm really not sure at this point. One issue I identified is the SDK reporting a wrong/malformed debug ID. I'm still in the process of isolating the root cause. That part of the SDK has not changed in quite some time so I suspect the issue either originating in a change in Unity's IL2CPP part or our symbolication.

bitsandfoxes avatar Jun 05 '23 08:06 bitsandfoxes

@ernesernesto: Digging into it a bit more: Android: The debug IDs don't seem to match up between the event you shared with me and the logs. Did you manually remove them?

bitsandfoxes avatar Jun 05 '23 13:06 bitsandfoxes

@bitsandfoxes I was trying to figure out which one is the correct lib used for symbolication, hence I deleted it one by one before uploading and triggering the test. Here's the step that I did,

  1. delete all uploaded symbols on the dashboard
  2. build ios (symbols will automatically uploaded)
  3. build android (symbols will automatically uploaded)
  4. trigger error on ios
  5. trigger error on android

If I want to trigger it again in order for you to verify, would doing 2 - 5 enough? Or should I do steps 1 - 5?

I'll be retriggering the events again probably with the same exception but on different file, since it looks like it would be grouped into the same event if I triggered on the same source file. Let me know what you think so I could re-trigger it again

ernesernesto avatar Jun 05 '23 14:06 ernesernesto

If I want to trigger it again in order for you to verify, would doing 2 - 5 enough? Or should I do steps 1 - 5?

That'd be amazing! Yes, it would. Thanks!

bitsandfoxes avatar Jun 05 '23 15:06 bitsandfoxes

@bitsandfoxes I did steps 2-5, please check your mail, I've sent the latest symbols upload log and the event link, thanks!

ernesernesto avatar Jun 06 '23 13:06 ernesernesto

@bitsandfoxes any new info?

ernesernesto avatar Jun 09 '23 08:06 ernesernesto

I've been looking into this and it looks to me like there are two different issues. On Android, the debug symbols are missing and the logs make no indication of why that might be. And on iOS there is something off with the symbolication itself. I'm going to need some help from a different team on this one.

bitsandfoxes avatar Jun 09 '23 10:06 bitsandfoxes

Hi @bitsandfoxes looking for an updates if there's any :)

ernesernesto avatar Jun 22 '23 10:06 ernesernesto

Hey @ernesernesto unfortunately, no. But it's not forgotten nor dropped.

bitsandfoxes avatar Jun 23 '23 15:06 bitsandfoxes

I can finally reproduce this locally! Thank you so much for the repro @ernesernesto!

bitsandfoxes avatar Jul 10 '23 13:07 bitsandfoxes

Is this problem solved now?I reappear in this version 1.5.2 @bitsandfoxes

dingleqiang avatar Sep 13 '23 01:09 dingleqiang

Is this problem solved now?I reappear in this version 1.5.2 @bitsandfoxes

Are you referring to a different issue than the known limitation related to button click events?

bitsandfoxes avatar Sep 13 '23 18:09 bitsandfoxes

Is this problem solved now?I reappear in this version 1.5.2 @bitsandfoxes

Are you referring to a different issue than the known limitation related to button click events?

Here is my test code:

private void Start()
{
    Debug.Log("This is a info");
    Debug.LogWarning("This is a warning");
    Debug.LogError("This is a error");
    Debug.LogException(new Exception("This is a Exception"));
    TestMethod1();
}

private void TestMethod1()
{
    TestMethod();
}

private void TestMethod()
{
    foreach (var VARIABLE in "COLLECTION")
    {
        GetComponent<Rigidbody>().drag = 12;//Rigidbody component is null
    }
}

dingleqiang avatar Sep 14 '23 01:09 dingleqiang

Thanks for providing the repro @dingleqiang. Are you on Unity 2021.3. as well?

bitsandfoxes avatar Sep 18 '23 19:09 bitsandfoxes

I can confirm same issue on Android and IOS using Unity 2022.3.14, any updates?

frikic avatar Dec 26 '23 17:12 frikic

A thousand apologies. I missed the notification on this one. I'll update our docs to properly reflect the current limitations. But to summarize it here: Events going through the logger do not have line numbers. It's possible to have the stacktrace show up on the event by enabling AttachStacktrace on the options. As of right now, the IL2CPP line number feature requires an exception to go through the exception processor and retrieve the instruction addresses from Unity's IL2CPP backend. This includes Debug.LogException since Unity omits the stacktrace on the exception. Instead, it's recommended to use SentrySdk.CaptureException instead.

bitsandfoxes avatar Jan 03 '24 17:01 bitsandfoxes

So I need a bit of clarification then "This includes Debug.LogException since Unity omits the stacktrace on the exception. Instead, it's recommended to use SentrySdk.CaptureException instead."

We need to use Debug.LogException or SentrySdk.CaptureException in order to make it work? exception that Unity throws do not work.

frikic avatar Jan 11 '24 13:01 frikic

SentrySdk.CaptureException works and events captured through this should have correct stacktraces and line numbers.

bitsandfoxes avatar Jan 12 '24 10:01 bitsandfoxes