Page 1 of 1

(done) VS Exception involving TwigTokenCache

PostPosted: August 9th, 2018, 7:18 pm
by jason.maclean
This is hapenning on multiple dev env, using VS pro 2017. We can trigger this exception regularly by backspacing over a block of code like this:

{% endif %}

As soon as backspace crosses over the }

Full exception:
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: length at Microsoft.VisualStudio.Text.Span..ctor(Int32 start, Int32 length) at Microsoft.VisualStudio.Text.Implementation.BaseSnapshot.GetText(Int32 startIndex, Int32 length) at Devsense.VisualStudio.Twig.Code.TwigTokenCache.Update(ITextSnapshot snapshot) at Devsense.VisualStudio.Twig.Code.TwigTokenCache.GetTokens(SnapshotSpan position) at Devsense.VisualStudio.Twig.Classifier.TwigClassifier.GetClassificationSpans(SnapshotSpan span) at Microsoft.VisualStudio.Text.Classification.Implementation.ClassifierTagger.<GetTags>d__5.MoveNext() at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.<GetTagsForBuffer>d__39.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

Re: VS Exception involving TwigTokenCache

PostPosted: August 10th, 2018, 2:13 pm
by Michal Brabec
Hi Jason,
thank you for reporting the issue.
We were able to reproduce and fix it.
The updated Twig support will be released with the next update of PHP Tools.
Best regards,
Michal