Exemplo n.º 1
0
        protected void LogUnhandledEngineException(Exception ex, IResultLogger logger)
        {
            TContext context = new TContext();

            context.Rule = ErrorDescriptors.AnalysisHalted;

            // An unhandled exception was raised during analysis: {0}
            logger.Log(ResultKind.InternalError, context, null,
                       nameof(SdkResources.ERR0999_UnhandledEngineException),
                       ex.ToString());

            RuntimeErrors |= RuntimeConditions.ExceptionInEngine;
        }
Exemplo n.º 2
0
        protected void LogExceptionCreatingLogFile(string fileName, IResultLogger logger, Exception ex)
        {
            var context = new TContext();

            context.Rule = ErrorDescriptors.InvalidConfiguration;

            // An exception was raised attempting to create output file '{0}'. Exception information:
            // {1}
            logger.Log(ResultKind.ConfigurationError, context, null,
                       nameof(SdkResources.ERR0997_ExceptionCreatingLogFile),
                       fileName,
                       ex.ToString());

            RuntimeErrors |= RuntimeConditions.ExceptionCreatingLogfile;
        }
Exemplo n.º 3
0
        public Task Run()
        {
            _tokenSource?.Dispose();
            _tokenSource = new CancellationTokenSource();
            var cancellationToken = _tokenSource.Token;

            _runningTask = Task.Factory.StartNew(() =>
            {
                while (cancellationToken.IsCancellationRequested == false)
                {
                    var result = false;
                    while (result == false)
                    {
                        result = _pinger.Ping();
                        _resultLogger.Log(DateTime.Now, result);
                    }

                    _waitFunction();
                }
            }, _tokenSource.Token);
            return(_runningTask);
        }