private void RefreshTrackingSpansAsync(Document document, ITextSnapshot snapshot) { _editSession.GetDocumentAnalysis(document).GetValueAsync(_editSession.Cancellation.Token).SafeContinueWith(task => { // Do nothing if the statements aren't available (in presence of compilation errors). if (!task.Result.ActiveStatements.IsDefault) { RefreshTrackingSpans(document.Id, snapshot, task.Result.ActiveStatements); } }, _editSession.Cancellation.Token, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.Default); }
private async Task RefreshTrackingSpansAsync(Document baseDocument, Document document, ITextSnapshot snapshot) { try { var documentAnalysis = await _editSession.GetDocumentAnalysis(baseDocument, document).GetValueAsync(_editSession.CancellationToken).ConfigureAwait(false); // Do nothing if the statements aren't available (in presence of compilation errors). if (!documentAnalysis.ActiveStatements.IsDefault) { RefreshTrackingSpans(document.Id, snapshot, documentAnalysis.ActiveStatements); } } catch (Exception e) when(FatalError.ReportWithoutCrashUnlessCanceled(e)) { // nop } }