Example #1
0
 public static void Throw(ISequencerUC sequencer,
                          Exception innerException = null,
                          string message           = null,
                          int skipStackFrames      = 4,
                          [CallerMemberName] string calllerName   = "",
                          [CallerFilePath] string callerFileName  = "",
                          [CallerLineNumber] int callerLineNumber = 0)
 {
     sequencer?.Throw(innerException, message, skipStackFrames, calllerName, callerFileName, callerLineNumber);
 }
Example #2
0
 private static void ThrowWorker_DetectException(ISequencerUC sequencer)
 {
     try
     {
         throw new Exception("Detect raised exception");
     }
     catch (Exception ex)
     {
         sequencer.Throw(ex);
     }
 }
 private static void ThrowWorker_ConditionalException(bool detect, ISequencerUC sequencer)
 {
     try
     {
         throw new Exception("Detect raised exception");
     }
     catch (Exception ex)
     {
         sequencer.Throw(() => detect, ex);
     }
 }
Example #4
0
 private void LockedWorker(ISequencerUC sequencer, object objLock)
 {
     try
     {
         sequencer.Point(SeqPointTypeUC.Notify, Worker.BeforeLock, Thread.CurrentThread);
         lock (objLock)
         {
             sequencer.Point(SeqPointTypeUC.Notify, Worker.Locked, Thread.CurrentThread);
             NamedPipeServerStream pipeServer = new NamedPipeServerStream("testpipe", PipeDirection.Out);
             sequencer.Point(SeqPointTypeUC.Notify, Worker.Stuck, Thread.CurrentThread);
             pipeServer.WaitForConnection();
             pipeServer.Dispose();
             sequencer.Throw(null, $"It was supposed to stuck {nameof(NamedPipeServerStream)}.{nameof(NamedPipeServerStream.WaitForConnection)}in unmanaged part of code, but did not happened!");
         }
     }
     catch (Exception ex)
     {
         sequencer.Throw(ex, $"It was supposed to stuck {nameof(NamedPipeServerStream)}.{nameof(NamedPipeServerStream.WaitForConnection)}in unmanaged part of code, but did not happened!");
     }
     finally
     {
         sequencer.Throw(null, $"It was supposed to stuck {nameof(NamedPipeServerStream)}.{nameof(NamedPipeServerStream.WaitForConnection)}in unmanaged part of code, but did not happened!");
     }
 }
 public static ISequencerUC Throw(this ISequencerUC sequencer,
                                  Exception innerException                = null,
                                  string message                          = null,
                                  int skipStackFrames                     = 3,
                                  [CallerMemberName] string callerName    = "",
                                  [CallerFilePath] string callerFileName  = "",
                                  [CallerLineNumber] int callerLineNumber = 0)
 {
     return
         (sequencer
          .Throw(() => true,
                 innerException,
                 message,
                 skipStackFrames,
                 callerName,
                 callerFileName,
                 callerLineNumber)
         );
 }