private string GenerateRtf(NormalizedSnapshotSpanCollection spans)
 {
     // This behavior is consistent with VS editor. 
     // Don't generate RTF for large spans (since it is expensive and probably not wanted).
     int length = spans.Sum((span) => span.Length);
     if (length < 1000000)
     {                                           
         using (var dialog = _waitIndicator.StartWait(InteractiveWindowResources.WaitTitle, InteractiveWindowResources.WaitMessage, allowCancel: true))
         {                           
             return _rtfBuilderService.GenerateRtf(spans, dialog.CancellationToken);
         }
     }
     else
     {
         return null;
     }
 }
		string TryCreateHtmlText(NormalizedSnapshotSpanCollection spans) {
			if (spans.Count == 0)
				return null;

			// There's no way for us to cancel it so don't classify too much text
			int totalChars = spans.Sum(a => a.Length);
			const int maxTotalCharsToCopy = 1 * 1024 * 1024;
			if (totalChars > maxTotalCharsToCopy)
				return null;
			var cancellationToken = CancellationToken.None;

			return htmlBuilderService.GenerateHtmlFragment(spans, TextView, cancellationToken);
		}