Example #1
0
 internal void Fail(Exception ex)
 {
     // Make sure the Abort state is set before signaling the callback so we can avoid race condtions with user code.
     Dispose();
     _requestStream.Abort();
     if (_tcs.TrySetException(ex) && _callback != null)
     {
         try
         {
             _callback(this);
         }
         catch (Exception)
         {
             // TODO: Exception handling? This may be an IO callback thread and throwing here could crash the app.
             // TODO: Log
         }
     }
 }