コード例 #1
0
        /// <summary>
        /// Initializes the Splunk MINT plugin with additions for Xamarin.
        /// </summary>
        /// <param name="apiKey">Your Splunk MINT API key.</param>
        public void InitAndStartXamarinSession(string apiKey)
        {
            XamarinHelper.XamarinVersion("4.0.1");
            XamarinHelper.XamarinArchitecture("armv7s");

            TaskScheduler.UnobservedTaskException       += UnobservedTaskExceptionsHandler;
            AsyncSynchronizationContext.ExceptionCaught += SyncContextExceptionHandler;
            AsyncSynchronizationContext.Register();

            if (Debugger.IsAttached)
            {
                DisableCrashReporter();
            }

            IntPtr sigbus  = Marshal.AllocHGlobal(512);
            IntPtr sigsegv = Marshal.AllocHGlobal(512);

            // Store Mono SIGSEGV and SIGBUS handlers
            sigaction(Signal.SIGBUS, IntPtr.Zero, sigbus);
            sigaction(Signal.SIGSEGV, IntPtr.Zero, sigsegv);

            InitAndStartSession(apiKey);

            // Restore Mono SIGSEGV and SIGBUS handlers
            sigaction(Signal.SIGBUS, sigbus, IntPtr.Zero);
            sigaction(Signal.SIGSEGV, sigsegv, IntPtr.Zero);

            Marshal.FreeHGlobal(sigbus);
            Marshal.FreeHGlobal(sigsegv);
        }
コード例 #2
0
 /// <summary>
 /// Registers the async handler for unawaited void and Task unhandled exceptions that are thrown in the application.
 /// </summary>
 /// <remarks>
 /// This function might be needed in special cases where the synchronization context could be <c>null</c> in early initialization.
 /// The async handlers are registered in the initialization process of the component.
 /// </remarks>
 public void RegisterAsyncHandlerContext()
 {
     AsyncSynchronizationContext.ExceptionCaught += SyncContextExceptionHandler;
     AsyncSynchronizationContext.Register();
 }