protected override void Run() { if (IdeApp.ProjectOperations.CurrentSelectedProject == null) { AnalyzeWholeSolutionHandler.Execute(); } else { AnalyzeCurrentProjectHandler.Execute(); } }
internal static async void Execute() { var project = IdeApp.ProjectOperations.CurrentSelectedProject; if (project == null) { return; } var analysisProject = IdeApp.TypeSystemService.GetCodeAnalysisProject(project); if (analysisProject == null) { return; } try { using (var monitor = IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor(GettextCatalog.GetString("Analyzing project"), null, false, true, false, null, true)) { CancellationToken token = monitor.CancellationToken; var allDiagnostics = await Task.Run(async delegate { var diagnosticList = new List <Diagnostic> (); monitor.BeginTask(GettextCatalog.GetString("Analyzing {0}", project.Name), 1); var providers = await AnalyzeWholeSolutionHandler.GetProviders(analysisProject); diagnosticList.AddRange(await AnalyzeWholeSolutionHandler.GetDiagnostics(analysisProject, providers, token)); monitor.EndTask(); return(diagnosticList); }).ConfigureAwait(false); await Runtime.RunInMainThread(delegate { AnalyzeWholeSolutionHandler.Report(monitor, allDiagnostics, project); }).ConfigureAwait(false); } } catch (OperationCanceledException) { } catch (AggregateException ae) { ae.Flatten().Handle(ix => ix is OperationCanceledException); } catch (Exception e) { LoggingService.LogError("Error while running diagnostics.", e); } }