private void AnalyzeEntry() { var stopWatch = _log != null?Stopwatch.StartNew() : null; try { if (!_entry.IsValidVersion(Version, out var module, out var ast)) { if (ast == null) { // Entry doesn't have ast yet. There should be at least one more session. Cancel(); } _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) canceled."); return; } var startTime = stopWatch?.Elapsed ?? TimeSpan.Zero; AnalyzeEntry(null, _entry, module, ast, Version); LogCompleted(null, module, stopWatch, startTime); } catch (OperationCanceledException oce) { _entry.TryCancel(oce, Version); LogCanceled(_entry.Module); } catch (Exception exception) { _entry.TrySetException(exception, Version); LogException(_entry.Module, exception); } finally { stopWatch?.Stop(); Interlocked.Decrement(ref _runningTasks); } }
private void Analyze(PythonAnalyzerEntry entry, int version, CancellationToken cancellationToken) { var stopWatch = Stopwatch.StartNew(); try { if (!entry.IsValidVersion(version, out var module, out var ast)) { _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) canceled."); return; } var startTime = stopWatch.Elapsed; AnalyzeEntry(entry, module, ast, version, cancellationToken); _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) completed in {(stopWatch.Elapsed - startTime).TotalMilliseconds} ms."); } catch (OperationCanceledException oce) { entry.TryCancel(oce, version); var module = entry.Module; _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) canceled."); } catch (Exception exception) { var module = entry.Module; entry.TrySetException(exception, version); _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) failed."); } finally { stopWatch.Stop(); Interlocked.Decrement(ref _runningTasks); } }
private void AnalyzeEntry() { var stopWatch = Stopwatch.StartNew(); try { if (!_entry.IsValidVersion(Version, out var module, out var ast)) { if (ast == null) { // Entry doesn't have ast yet. There should be at least one more session. Cancel(); } _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) canceled."); return; } var startTime = stopWatch.Elapsed; AnalyzeEntry(_entry, module, ast, Version); _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) completed in {(stopWatch.Elapsed - startTime).TotalMilliseconds} ms."); } catch (OperationCanceledException oce) { _entry.TryCancel(oce, Version); var module = _entry.Module; _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) canceled."); } catch (Exception exception) { var module = _entry.Module; _entry.TrySetException(exception, Version); _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) failed. Exception message: {exception.Message}."); } finally { stopWatch.Stop(); Interlocked.Decrement(ref _runningTasks); } }
private void AnalyzeEntry() { var stopWatch = _log != null?Stopwatch.StartNew() : null; try { if (!_entry.CanUpdateAnalysis(Version, out var module, out var ast, out var currentAnalysis)) { if (currentAnalysis is LibraryAnalysis) { return; } else if (ast == default) { if (currentAnalysis == default) { // Entry doesn't have ast yet. There should be at least one more session. Cancel(); } else { Debug.Fail($"Library module {module.Name} of type {module.ModuleType} has been analyzed already!"); } } _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) canceled."); return; } var startTime = stopWatch?.Elapsed ?? TimeSpan.Zero; AnalyzeEntry(null, _entry, module, ast, Version); LogCompleted(null, module, stopWatch, startTime); } catch (OperationCanceledException oce) { _entry.TryCancel(oce, Version); LogCanceled(_entry.Module); } catch (Exception exception) { _entry.TrySetException(exception, Version); LogException(_entry.Module, exception); } finally { stopWatch?.Stop(); } }
private void AnalyzeEntry() { var stopWatch = _log != null?Stopwatch.StartNew() : null; try { if (!CanUpdateAnalysis(_entry, null, Version, out var module, out var ast, out var currentAnalysis)) { return; } var startTime = stopWatch?.Elapsed ?? TimeSpan.Zero; AnalyzeEntry(null, _entry, module, ast, Version); LogCompleted(null, module, stopWatch, startTime); } catch (OperationCanceledException oce) { _entry.TryCancel(oce, Version); LogCanceled(_entry.Module); } catch (Exception exception) { _entry.TrySetException(exception, Version); LogException(_entry.Module, exception); } finally { stopWatch?.Stop(); } }