internal ProxyOperationRuntime GetOperation(MethodBase methodBase, object[] args, out bool canCacheResult) { if (this.operationSelector == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException (SR.GetString(SR.SFxNeedProxyBehaviorOperationSelector2, methodBase.Name, methodBase.DeclaringType.Name))); } try { if (operationSelector.AreParametersRequiredForSelection) { canCacheResult = false; } else { args = null; canCacheResult = true; } bool outputTiming = DS.OperationSelectorIsEnabled(); Stopwatch sw = null; if (outputTiming) { sw = Stopwatch.StartNew(); } string operationName = operationSelector.SelectOperation(methodBase, args); if (outputTiming) { DS.ClientSelectOperation(operationSelector.GetType(), operationName, sw.Elapsed); } ProxyOperationRuntime operation; if ((operationName != null) && this.operations.TryGetValue(operationName, out operation)) { return(operation); } else { // did not find the right operation, will not know how // to invoke the method. return(null); } } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } if (ErrorBehavior.ShouldRethrowClientSideExceptionAsIs(e)) { throw; } throw DiagnosticUtility.ExceptionUtility.ThrowHelperCallback(e); } }