public int HighlightMatchingBrace(uint dwFlags, uint cSpans, TextSpan[] rgBaseSpans) { if ((null == rgBaseSpans) || (rgBaseSpans.Length == 0)) { throw new ArgumentNullException("rgBaseSpans"); } if ((uint)rgBaseSpans.Length != cSpans) { throw new System.ArgumentOutOfRangeException("cSpans"); } TextSpan[] convertedSpans = new TextSpan[cSpans]; TextSpan[] workingCopy = new TextSpan[1]; try { for (int i = 0; i < cSpans; ++i) { ErrorHandler.ThrowOnFailure(bufferCoordinator.MapSecondaryToPrimarySpan(rgBaseSpans[i], workingCopy)); convertedSpans[i] = workingCopy[0]; } return(intellisenseHost.HighlightMatchingBrace(dwFlags, cSpans, convertedSpans)); } catch { return(VSConstants.E_FAIL); } }