// End should be called when the End function for the asynchronous operation is complete. It // ensures the asynchronous operation is complete, and does some common validation. internal static EtwTrackingAsyncResult End(EtwTrackingAsyncResult asyncResult) { if (asyncResult == null) { throw new ArgumentException(Resources.InvalidAsyncResult); } if (asyncResult._endCalled) { throw new InvalidOperationException(Resources.AsyncResultAlreadyEnded); } asyncResult._endCalled = true; if (!asyncResult._isCompleted) { asyncResult.AsyncWaitHandle.WaitOne(); } if (asyncResult._manualResetEvent != null) { // was manualResetEvent.Close(); asyncResult._manualResetEvent.Dispose(); } if (asyncResult._exception != null) { throw asyncResult._exception; } return(asyncResult); }
protected override void EndTrack(IAsyncResult result) { EtwTrackingAsyncResult.End(result as EtwTrackingAsyncResult); }