Пример #1
0
        public static SarifLog AnalyzeDll(string inputPath, ScopeMethodKind kind, bool useScopeFactory = true, bool interProc = false, StreamWriter outputStream = null, TimeSpan timeout = default(TimeSpan))
        {
            if (timeout == default(TimeSpan))
            {
                timeout = TimeSpan.FromMinutes(1);
            }
            if (System.Diagnostics.Debugger.IsAttached)
            {
                timeout = TimeSpan.FromMilliseconds(-1);
            }
            var task = Task.Run(() => ScopeProgramAnalysis.AnalyzeDll(inputPath, kind, useScopeFactory, interProc, outputStream));

            if (task.Wait(timeout))
            {
                return(task.Result);
            }
            else
            {
                var log = SarifLogger.CreateSarifOutput();
                var r   = SarifLogger.CreateRun(inputPath, "No results", "Timeout", new List <Result>());
                log.Runs.Add(r);
                return(log);
            }
        }