internal static void ThrowIfFaulted(this CommunicationObject communicationObject) { switch (communicationObject.State) { case CommunicationState.Created: case CommunicationState.Opening: case CommunicationState.Opened: case CommunicationState.Closing: case CommunicationState.Closed: { return; } default: { throw Fx.Exception.AsWarning(communicationObject.CreateFaultedException(), null); } } }