Unused HockeyApp component for Android (Xamarin Component Store)

I tried to include the component mentioned above.

http://components.xamarin.com/view/hockeyappios

I created a very simple project based on the Xamarin Studio (Android Ice Cream Sandwich Application) template. Then I added the necessary code to send exceptions to HockeyApp. This code is described on the next page.

http://components.xamarin.com/gettingstarted/hockeyappandroid

Unfortunately, I found a serious problem saving the exception data file

HockeyApp.ManagedExceptionHandler.SaveException (e.ExceptionObject)

This call results in the following error

[mono-rt] Stacktrace:
[mono-rt] 
[mono-rt]   at <unknown> <0xffffffff>
[mono-rt]   at (wrapper managed-to-native) object.wrapper_native_0x407339b5 (intptr,string) <IL 0x00038, 0xffffffff>
[mono-rt]   at Android.Runtime.JNIEnv.FindClass (string) [0x00000] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/b5dc5ce9/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:377
[mono-rt]   at Android.Runtime.JNIEnv.FindClass (string,intptr&) [0x00014] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/b5dc5ce9/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:409
[mono-rt]   at Android.OS.Looper.get_class_ref () [0x00000] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/b5dc5ce9/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.OS.Looper.cs:14
[mono-rt]   at Android.OS.Looper.get_MainLooper () [0x00014] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/b5dc5ce9/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.OS.Looper.cs:34
[mono-rt]   at Android.App.SyncContext.Send (System.Threading.SendOrPostCallback,object) [0x00014] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/b5dc5ce9/source/monodroid/src/Mono.Android/src/Android.App/SyncContext.cs:24
[mono-rt]   at HockeyApp.ManagedExceptionHandler.Save (string) <IL 0x0001f, 0x00157>
[mono-rt]   at HockeyApp.ManagedExceptionHandler.SaveException (object) <IL 0x00006, 0x0006b>
[mono-rt]   at HockeyAppTest.App.<OnCreate>b__0 (object,System.UnhandledExceptionEventArgs) [0x00002] in c:\Snapshot\HockeyAppTest\Application.cs:33
[mono-rt]   at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object_object (object,intptr,intptr,intptr) <IL 0x0005a, 0xffffffff>
[mono-rt] 
[mono-rt] =================================================================
[mono-rt] Got a SIGSEGV while executing native code. This usually indicates
[mono-rt] a fatal error in the mono runtime or one of the native libraries 
[mono-rt] used by your application.
[mono-rt] =================================================================

While studying the problem, I came across the following information

  • The processed exception can be saved without problems.
  • The problem only occurs in the AppDomain.CurrentDomain.UnhandledException handler

AppDomain.CurrentDomain.UnhandledException

string eStr = e.ExceptionObject.ToString();
Java.Lang.Throwable thr = new Java.Lang.Throwable(eStr);

[mono-rt] Stacktrace:
[mono-rt] 
[mono-rt]   at <unknown> <0xffffffff>
[mono-rt]   at (wrapper managed-to-native) object.wrapper_native_0x4072e4e5 (intptr,intptr,int) <IL 0x00027, 0xffffffff>
[mono-rt]   at Android.Runtime.JNIEnv.NewString (string) [0x00017] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/b5dc5ce9/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:666
[mono-rt]   at Java.Lang.Throwable..ctor (string) [0x00022] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/b5dc5ce9/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Java.Lang.Throwable.cs:50
[mono-rt]   at HockeyAppTest.App.<OnCreate>b__0 (object,System.UnhandledExceptionEventArgs) [0x0000d] in c:\Snapshot\HockeyAppTest\Application.cs:34
[mono-rt]   at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object_object (object,intptr,intptr,intptr) <IL 0x0005a, 0xffffffff>

witch, " java" AppDomain.CurrentDomain.UnhandledException?

+4
2

, # , JNI-.

, # HockeyApp Java HockeyApp.

, https://github.com/tpurtell/AndroidHockeyApp/blob/master/Additions/TraceWriter.cs#L84

HockeyApp Exception, , -, .

+4

:

  AndroidEnvironment.UnhandledExceptionRaiser += (s, e) => 
       HockeyApp.ManagedExceptionHandler.SaveException(e.Exception);
  Thread.DefaultUncaughtExceptionHandler = new UnCaughtExceptionHandler(this);

:

AppDomain.CurrentDomain.UnhandledException += (sender, e) => 
            HockeyApp.ManagedExceptionHandler.SaveException (e.ExceptionObject);

UnCaughtExceptionHandler - , , , HockeyApp.ManagedExceptionHandler.SaveException() ( ). , HockeyApp.ManagedExceptionHandler.SaveException(object exceptionObject), , , .


UnCaughtExceptionHandler

    class UnCaughtExceptionHandler : Java.Lang.Object, Thread.IUncaughtExceptionHandler
    {
        readonly Context context;
        public UnCaughtExceptionHandler(Context context)
        {
            this.context = context;
        }

        public void UncaughtException(Thread thread, Throwable ex)
        {
           HockeyApp.ManagedExceptionHandler.SaveException(ex);
        }

    }
0

Source: https://habr.com/ru/post/1544918/


All Articles