CLR_EXCEPTION_System.ArgumentOutOfRangeException_80131502_TSLint.dll
madskristensen opened this issue · 3 comments
An undhandled ArgumentOutOfRangeException is thrown by tslint.dll and it has to do with the constructor of SnapshotSpan.
- Microsoft.VisualStudio.Text.Data.ni!Microsoft.VisualStudio.Text.SnapshotSpan..ctor
It would be great if you could provide:
- Version of Visual Studio you are using
- Version of
tslint
&tsc
that you have locally installed .ts
file that reproduces the error (just the bare minimum)
I don't have it installed. We saw the issue show up in the Watson logs for Visual Studio. I should have mentioned that in the initial bug, but I work on the Visual Studio extensibility team and that's the reason I opened the issue.
Usually when you get an ArgumentOutOfRangeException it is because you are creating a new SnapshotSpan where the length is longer than the underlying text buffer. A simple check around the place where you call the SnapshotSpan constructor to check the bounds should do the trick.
In TsLintTagger.cs
I have:
span = new SnapshotSpan(
this._view.TextSnapshot,
Span.FromBounds(startLine.Start + start, endLine.Start + end)
);
I could change it to something like:
var endBound = endLine.Start.Position + end;
if (endBound > this._view.TextSnapshot.Length)
endBound = this._view.TextSnapshot.Length;
span = new SnapshotSpan(
this._view.TextSnapshot,
Span.FromBounds(startLine.Start + start, endBound)
);
But, I would really appreciate if you could provide mi with a .ts
file that can exhibits the issue so I could properly test it.