private static void CacheMethodCall(object oParameters) { CacheMethodCallParams parameters = (CacheMethodCallParams)oParameters; try { Monitor.Enter(DynamicLock.Get(CACHING_LOCK_TYPE, parameters.CachingKey)); parameters.Method._mi.Invoke(null, (new object[] { parameters.Request, parameters.Reply.Result, parameters.Reply.Error })); if (!parameters.Reply.Error.Exists) { ResultCache.CacheResult( parameters.Method.Id, parameters.ResultKey, parameters.Request.ParameterSet.ToXml().ToXElement(), parameters.Reply.Result.Raw.ToXElement() ); } } catch (Exception e) { Manager.LogFault(parameters.Request, parameters.Reply, parameters.Method, "AsynchronousInvocationException", e); } finally { lock (DynamicLock.Lock) { Monitor.Exit(DynamicLock.Get(CACHING_LOCK_TYPE, parameters.CachingKey)); DynamicLock.Remove(CACHING_LOCK_TYPE, parameters.CachingKey); } } }