After decompiling a bunch of related classes in System.ServiceModel I was able to get a little more information.
It looks like the Open call breaks down the inheritance tree to CommunicationObject, where its Open method is called. All this seems to provide a set of diagnostic information and increases the number of events.
The ChannelFactory class uses open events to perform a number of tasks, including creating its internal factory channel:
protected override void OnOpening() { base.OnOpening(); this.innerFactory = this.CreateFactory(); if (this.innerFactory == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString("InnerChannelFactoryWasNotSet"))); } }
As mentioned here, Close events are also used to perform actions such as closing all underlying channels (through the internal factory channel):
protected override void OnClose(TimeSpan timeout) { TimeoutHelper timeoutHelper = new TimeoutHelper(timeout); while (true) { IChannel channel; lock (base.ThisLock) { if (this.channelsList.Count == 0) { break; } channel = this.channelsList[0]; } channel.Close(timeoutHelper.RemainingTime()); } }
Trey combs
source share