static VsTextSpan GetVsTextSpan(SourceText text, TextSpan textSpan) { var boundedTextSpan = GetSpanWithinDocumentBounds(textSpan, text.Length); if (boundedTextSpan != textSpan) { try { throw new ArgumentOutOfRangeException(); } catch (ArgumentOutOfRangeException e) when(FatalError.ReportAndCatch(e)) { } } return(text.GetVsTextSpanForSpan(boundedTextSpan)); }