protected virtual void OnRequestReceived(HttpRequestEventArgs e) { foreach (HttpRequestEventHandler handler in RequestReceived.GetInvocationList()) { try { handler.Invoke(this, e); } catch (Exception ex) { ex.Source = handler.Method.Module + "/" + handler.Method.DeclaringType.Name + "/" + handler.Method.Name; RaiseUnhandledException(e.Context, ex); } } }
private bool _disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { Log.Info($"{this}: Dispose({disposing})"); if (!_disposedValue) { if (disposing) { _closedCancellation.Cancel(); foreach (RequestReceived callback in (RequestReceived?.GetInvocationList() ?? Enumerable.Empty <Delegate>())) { RequestReceived -= callback; } _closedCancellation?.Dispose(); } _disposedValue = true; } }