示例#1
0
        /// <inheritdoc />
        public void SendException(Exception exception)
        {
            var error = exception.AsError();

            error.SetTrace(this);
            SendResult(error);
        }
示例#2
0
 public static char[] AllocateCharArray(int size)
 {
     char[] chArray;
     try
     {
         chArray = new char[size];
     }
     catch (OutOfMemoryException exception)
     {
         throw Exception.AsError(new InsufficientMemoryException(SRCore.BufferAllocationFailed(size * 2), exception));
     }
     return(chArray);
 }
示例#3
0
 public static byte[] AllocateByteArray(int size)
 {
     byte[] buffer;
     try
     {
         buffer = new byte[size];
     }
     catch (OutOfMemoryException exception)
     {
         throw Exception.AsError(new InsufficientMemoryException(SRCore.BufferAllocationFailed(size), exception));
     }
     return(buffer);
 }
示例#4
0
 internal static byte[] AllocateByteArray(int size)
 {
     try
     {
         // Safe to catch OOM from this as long as the ONLY thing it does is a simple allocation of a primitive type (no method calls).
         return(new byte[size]);
     }
     catch (OutOfMemoryException exception)
     {
         // Convert OOM into an exception that can be safely handled by higher layers.
         throw Exception.AsError(exception);
         //new InsufficientMemoryException(InternalSR.BufferAllocationFailed(size), exception));
     }
 }