Example #1
0
		internal Exception GetExceptionIfBrokenSession(CimSession potentiallyBrokenSession, bool skipTestConnection, out bool sessionWasAlreadyTerminated)
		{
			CimInstance cimInstance = null;
			CimException cimException = null;
			if (!this.IsSessionTerminated(potentiallyBrokenSession))
			{
				Exception exception = null;
				if (!skipTestConnection && !this.DidSessionAlreadyPassedConnectivityTest(potentiallyBrokenSession))
				{
					try
					{
						potentiallyBrokenSession.TestConnection(out cimInstance, out cimException);
						exception = cimException;
						if (exception == null)
						{
							this.MarkSessionAsConnected(potentiallyBrokenSession);
						}
					}
					catch (InvalidOperationException invalidOperationException1)
					{
						InvalidOperationException invalidOperationException = invalidOperationException1;
						exception = invalidOperationException;
					}
				}
				if (exception == null)
				{
					sessionWasAlreadyTerminated = false;
					return exception;
				}
				else
				{
					this.MarkSessionAsTerminated(potentiallyBrokenSession, out sessionWasAlreadyTerminated);
					return exception;
				}
			}
			else
			{
				sessionWasAlreadyTerminated = true;
				return null;
			}
		}