private IRemoteMessage[] InvokeRemoteAnalyzer(IEnumerable <string> sourceFilePaths, IEnumerable <string> referencedAssemblyPaths)
        {
            TraceMessageHandler?.Invoke("Calling analyzer service.");

            var proxy  = (IRemoteDependencyAnalyzer)Activator.GetObject(typeof(IRemoteDependencyAnalyzer), _serviceAddress);
            var result = proxy.AnalyzeProject(ConfigProvider.Config, sourceFilePaths.ToArray(), referencedAssemblyPaths.ToArray());

            TraceMessageHandler?.Invoke("Calling analyzer service succeeded.");

            return(result);
        }
        private void ActivateServerAndWaitBeforeRetry(Exception e, int retryCount, TimeSpan[] retryTimeSpans)
        {
            TraceMessageHandler?.Invoke($"{CommunicationErrorMessage} Exception: {e.Message}");

            TraceMessageHandler?.Invoke($"Trying to activate analyzer service (attempt #{retryCount + 1}).");
            AnalyzerServiceActivator.Activate(TraceMessageHandler);

            var sleepTimeSpan = retryTimeSpans[retryCount];

            TraceMessageHandler?.Invoke($"Retrying service call after: {sleepTimeSpan}.");
            Thread.Sleep(sleepTimeSpan);
        }
Ejemplo n.º 3
0
        private IEnumerable <TypeDependency> GetIllegalTypeDependencies(Func <IEnumerable <TypeDependency> > typeDependencyEnumerator)
        {
            var illegalDependencies = typeDependencyEnumerator()
                                      .Where(i => !_typeDependencyValidator.IsAllowedDependency(i))
                                      .Take(_config.MaxIssueCount + 1);

            foreach (var illegalDependency in illegalDependencies)
            {
                yield return(illegalDependency);
            }

            TraceMessageHandler?.Invoke(GetCacheStatisticsMessage(_typeDependencyValidator));
        }
        private IEnumerable <TypeDependency> UnwrapTraceMessages(IRemoteMessage[] remoteMessages)
        {
            foreach (var remoteMessage in remoteMessages)
            {
                switch (remoteMessage)
                {
                case RemoteIllegalDependencyMessage illegalDependencyMessage:
                    yield return(illegalDependencyMessage.IllegalDependency);

                    break;

                case RemoteTraceMessage traceMessage:
                    TraceMessageHandler?.Invoke(traceMessage.Text);
                    break;

                default:
                    throw new Exception($"Unexpected IRemoteMessage type {remoteMessage?.GetType().Name}");
                }
            }
        }
Ejemplo n.º 5
0
 private void LogTraceMessage(string message) => TraceMessageHandler?.Invoke(message);