/// <inheritdoc /> public void SendException(Exception exception) { var error = exception.AsError(); error.SetTrace(this); SendResult(error); }
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); }
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); }
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)); } }