private static void WriteCompletedCallback(IAsyncResult result) { if (result.CompletedSynchronously) { return; } ProgressWriteAsyncResult thisPtr = (ProgressWriteAsyncResult)result.AsyncState; try { thisPtr.WriteCompleted(result); } catch (Exception e) { thisPtr.Complete(false, e); } }