Why do my stack traces only include line numbers if the debugger is attached?

前端 未结 1 1278
灰色年华
灰色年华 2021-01-20 01:51

I have a Xamarin.Android application that reports crashes to Raygun. The stack traces reported to Raygun from Release builds do not include line numbers. If I give the Relea

相关标签:
1条回答
  • 2021-01-20 02:10

    You would need to symbolize the "native" Android crash report via mono-symbolicate using the symbols of the release build (the build's msym and the build app must be from the same build).

    Some crash reporting services directly support Xamarin and allow you to upload the build's msym files and automatically run mono-symbolicate, others do not and thus require you to do it manually (or some support web-hooks and you can implement it yourself to run on each received crash report, I do it this way on Fabric)

    mono-symbolicate
    Usage: symbolicate [options] <msym dir> <input file>
           symbolicate [options] store-symbols <msym dir> [<dir>]+
    
    Available options:
      -h, --help                 Show this help
      -q                         Quiet, warnings are not displayed
      -v                         Verbose, log debug messages
    
    • https://developer.xamarin.com/releases/android/xamarin.android_7/xamarin.android_7.4/ (search the release text for mono-symbolicate)

    Next, grab a crash log which an unhandled exception

    adb logcat -d > errors.txt
    

    Finally, use mono-symbolicate to convert the errors to contain file and line numbers:

    mono-symbolicate path-to-dll-in-.mSYM-directory path-to-errors.txt
    

    For example, given an errors.txt with the contents:

    I/MonoDroid( 1545): System.Exception: wow it broke
    I/MonoDroid( 1545):   at CrashApp.MainActivity+<OnCreate>c__AnonStorey0.<>m__0 (System.Object , System.EventArgs ) [0x00030] in <filename unknown>:0
    I/MonoDroid( 1545):   at Android.Views.View+IOnClickListenerImplementor.OnClick (Android.Views.View v) [0x00014] in <filename unknown>:0
    I/MonoDroid( 1545):   at Android.Views.View+IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (IntPtr jnienv, IntPtr native__this, IntPtr native_v) [0x00011] in <filename unknown>:0
    I/MonoDroid( 1545):   at (wrapper dynamic-method) System.Object:5616285d-461b-4005-a31b-d4637a8cffffdc (intptr,intptr,intptr)
    

    mono-symbolicate will translate the above into:

    I/MonoDroid( 1545): System.Exception: wow it broke
    I/MonoDroid( 1545):   at CrashApp.MainActivity+<OnCreate>c__AnonStorey0.<>m__0 (System.Object , System.EventArgs ) [0x00030] in /Users/dean/Projects/CrashApp/CrashApp/MainActivity.cs:30
    I/MonoDroid( 1545):   at Android.Views.View+IOnClickListenerImplementor.OnClick (Android.Views.View v) [0x00014] in /Users/dean/Documents/Sandbox/Xamarin/dellismonodroid/src/Mono.Android/platforms/android-19/src/generated/Android.Webkit.WebBackForwardList.cs:68
    I/MonoDroid( 1545):   at Android.Views.View+IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (IntPtr jnienv, IntPtr native__this, IntPtr native_v) [0x00011] in /Users/dean/Documents/Sandbox/Xamarin/dellismonodroid/src/Mono.Android/platforms/android-19/src/generated/Android.Webkit.WebBackForwardList.cs:23
    I/MonoDroid( 1545):   at (wrapper dynamic-method) System.Object:5616285d-461b-4005-a31b-d4637a8cffffdc (intptr,intptr,intptr)
    
    0 讨论(0)
提交回复
热议问题