예제 #1
0
 public void SetAt(long newDueTimeInTicks)
 {
     if (newDueTimeInTicks >= TimeSpan.MaxValue.Ticks || newDueTimeInTicks < (long)0)
     {
         ExceptionTrace exception = Fx.Exception;
         object         obj       = newDueTimeInTicks;
         object         obj1      = 0;
         TimeSpan       maxValue  = TimeSpan.MaxValue;
         throw exception.ArgumentOutOfRange("newDueTime", obj, SRClient.ArgumentOutOfRange(obj1, maxValue.Ticks - (long)1));
     }
     IOThreadTimer.TimerManager.Value.Set(this, newDueTimeInTicks);
 }
예제 #2
0
 public static byte[] AllocateByteArray(int size)
 {
     byte[] numArray;
     try
     {
         numArray = new byte[size];
     }
     catch (OutOfMemoryException outOfMemoryException1)
     {
         OutOfMemoryException outOfMemoryException = outOfMemoryException1;
         ExceptionTrace       exception            = Fx.Exception;
         string   bufferAllocationFailed           = Resources.BufferAllocationFailed;
         object[] objArray = new object[] { size };
         throw exception.AsError(new InsufficientMemoryException(Microsoft.ServiceBus.SR.GetString(bufferAllocationFailed, objArray), outOfMemoryException), null);
     }
     return(numArray);
 }
예제 #3
0
        public TException TraceException <TException>(TException exception, TraceEventType level, EventTraceActivity activity = null)
            where TException : Exception
        {
            if (!exception.Data.Contains(this.eventSourceName))
            {
                exception.Data[this.eventSourceName] = this.eventSourceName;
                switch (level)
                {
                case TraceEventType.Critical:
                case TraceEventType.Error:
                {
                    if (!MessagingClientEtwProvider.Provider.IsEnabled(EventLevel.Error, 140737488355328L, EventChannel.Application | EventChannel.Security | EventChannel.Setup))
                    {
                        break;
                    }
                    MessagingClientEtwProvider.Provider.ThrowingExceptionError(activity, ExceptionTrace.GetDetailsForThrownException(exception));
                    break;
                }

                case TraceEventType.Warning:
                {
                    if (!MessagingClientEtwProvider.Provider.IsEnabled(EventLevel.Warning, 140737488355328L, EventChannel.Application | EventChannel.Security | EventChannel.Setup))
                    {
                        break;
                    }
                    MessagingClientEtwProvider.Provider.ThrowingExceptionWarning(activity, ExceptionTrace.GetDetailsForThrownException(exception));
                    break;
                }
                }
            }
            this.BreakOnException(exception);
            return(exception);
        }