//Note: This method changes the state of a static class. So results may not be as expected in multi-threaded scenarios. internal void InvokeTestHookInitializeMethod(Type type) { if (WebUtil.IsFriendClass(type)) { const BindingFlags bindingAttr = BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly; MethodInfo info = type.GetMethod("InitializeConfigurationTestHook", bindingAttr, null, new[] { typeof(ISyncServiceConfiguration) }, null); if ((info != null) && (info.ReturnType == typeof(void))) { ParameterInfo[] parameters = info.GetParameters(); if ((parameters.Length == 1) && !parameters[0].IsOut) { var objArray = new object[] { this }; try { info.Invoke(null, objArray); } catch (TargetInvocationException exception) { SyncTracer.Warning("Exception invoking the TestHookInitialization method. Details {0}", WebUtil.GetExceptionMessage(exception)); ErrorHandler.HandleTargetInvocationException(exception); throw; } return; } } } }