void ICorDebugManagedCallback2.Exception(
     ICorDebugAppDomain appDomain,
     ICorDebugThread thread,
     ICorDebugFrame frame,
     uint offset,
     CorDebugExceptionCallbackType eventType,
     uint flags)
 {
     if (DebugOutput)
     {
         Console.WriteLine("info: Exception2");
     }
     ExceptionHandled?.Invoke(this, new ExceptionEventArgs(appDomain, thread, frame, offset, eventType, flags));
     appDomain.Continue(0);
 }
Пример #2
0
        public TimerActionTask Binding(Action action)
        {
            XContract.ArgIsNotNull(action, nameof(action));

            var localAction = action;

            _timer.Elapsed +=
                (sender, args) =>
            {
                var restart = true;
                try
                {
                    localAction();

                    _timer.Interval = NormalFrequence.TotalMilliseconds;
                }
                catch (Exception ex)
                {
                    XDebug.OnException(ex);

                    if (!AutoCatchException)
                    {
                        restart = false;

                        throw;
                    }

                    ExceptionHandled?.Invoke(this, ex);

                    _timer.Interval = ErrorFrequence.TotalMilliseconds;
                }
                finally
                {
                    if (restart)
                    {
                        _timer.Start();
                    }
                }
            };

            return(this);
        }
Пример #3
0
 public void HandleError(object sender, Exception exception)
 => ExceptionHandled?.Invoke(sender, new ExceptionEventArgs(exception));