private void AddSyncEventHookup(object key, Delegate handler, RequestNotification notification, bool isPostNotification) {
            ThrowIfEventBindingDisallowed();

            // add the event to the delegate invocation list
            // this keeps non-pipeline ASP.NET hosts working
            Events.AddHandler(key, handler);

            // For integrated pipeline mode, add events to the IExecutionStep containers only if
            // InitSpecial has completed and InitInternal has not completed.
            if (IsContainerInitalizationAllowed) {
                // lookup the module index and add this notification
                PipelineModuleStepContainer container = GetModuleContainer(CurrentModuleCollectionKey);
                //WOS 1985878: HttpModule unsubscribing an event handler causes AV in Integrated Mode
                if (container != null) {
#if DBG
                    container.DebugModuleName = CurrentModuleCollectionKey;
#endif
                    SyncEventExecutionStep step = new SyncEventExecutionStep(this, (EventHandler)handler);
                    container.AddEvent(notification, isPostNotification, step);
                }
            }
        }
 private void AddSyncEventHookup(object key, Delegate handler, RequestNotification notification, bool isPostNotification)
 {
     this.ThrowIfEventBindingDisallowed();
     this.Events.AddHandler(key, handler);
     if (this.IsContainerInitalizationAllowed)
     {
         PipelineModuleStepContainer moduleContainer = this.GetModuleContainer(this.CurrentModuleCollectionKey);
         if (moduleContainer != null)
         {
             SyncEventExecutionStep step = new SyncEventExecutionStep(this, (EventHandler) handler);
             moduleContainer.AddEvent(notification, isPostNotification, step);
         }
     }
 }