From 048718b26c23389fd44cc149ca066dd8f96ffc02 Mon Sep 17 00:00:00 2001 From: Rinat Hafizov Date: Sat, 6 Aug 2016 20:01:51 +0300 Subject: [PATCH] Bugfix for #748 --- .../CSharpBinding/Project/Src/Parser/Parser.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/Parser.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/Parser.cs index 1e87ada3caa..9627fa2275f 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/Parser.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/Parser.cs @@ -101,19 +101,19 @@ void AddCommentTags(SyntaxTree cu, IList tagComments, ITextSource fi int endOffset; int searchOffset = 0; // HACK: workaround for parser bug: uses \n instead of \r\n in comment.Content - string commentContent = document.GetText(commentStartOffset, Math.Min(commentEndOffset - commentStartOffset + 1, commentEndOffset - commentStartOffset)); + string commentContent = document.GetText(commentStartOffset, Math.Abs(Math.Min(commentEndOffset - commentStartOffset + 1, commentEndOffset - commentStartOffset))); do { int start = commentStartOffset + searchOffset; int absoluteOffset = document.IndexOf(match, start, document.TextLength - start, StringComparison.Ordinal); var startLocation = document.GetLocation(absoluteOffset); endOffset = Math.Min(document.GetLineByNumber(startLocation.Line).EndOffset, commentEndOffset); - string content = document.GetText(absoluteOffset, endOffset - absoluteOffset); + string content = document.GetText(absoluteOffset, Math.Abs(endOffset - absoluteOffset)); if (content.Length < match.Length) { // HACK: workaround parser bug with multi-line documentation comments break; } tagComments.Add(new TagComment(content.Substring(0, match.Length), new DomRegion(cu.FileName, startLocation.Line, startLocation.Column), content.Substring(match.Length))); - searchOffset = endOffset - commentStartOffset; + searchOffset = Math.Abs(endOffset - commentStartOffset); } while (commentContent.ContainsAny(TaskListTokens, searchOffset, out match)); } }