Page 1 of 1

ArgumentOutOfRangeException in VS

PostPosted: April 15th, 2017, 9:40 am
by jorrit
When typing in PHP files of a PHP project in VS2015, it tries to evaluate the file, but of course it will show errors and warnings, because typing is in process. One of the first times this happens in a new VS session, VS always shows a message box refering to ActivityLog.xml. In the log, this is the exception made:
System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string.
Parameter name: startIndex
 at System.String.Substring(Int32 startIndex, Int32 length)
 at Microsoft.Web.Editor.Text.TextProvider.GetText(Int32 position, Int32 length)
 at Microsoft.Web.Editor.Text.TextProvider.GetText(ITextRange range)
 at Microsoft.Html.Core.Artifacts.ArtifactCollection.IsDestructiveChangeForItemSeparators(IArtifact item, ISensitiveFragmentSeparatorsInfo separatorInfo, String actualRightSeparator, Int32 start, Int32 oldLength, Int32 newLength, ITextProvider oldText, ITextProvider newText)
 at Microsoft.Html.Core.Parser.Fragments.SensitiveFragmentCollection`1.IsDestructiveChangeForSeparator(ISensitiveFragmentSeparatorsInfo separatorInfo, IReadOnlyList`1 itemsInRange, Int32 start, Int32 oldLength, Int32 newLength, ITextProvider oldText, ITextProvider newText)
 at Microsoft.Html.Core.Parser.Fragments.SensitiveFragmentCollection`1.IsDestructiveChange(Int32 start, Int32 oldLength, Int32 newLength, ITextProvider oldText, ITextProvider newText)
 at Microsoft.Html.Editor.Tree.TextChangeAnalyzer.ChangeInsideArtifact(TextChangeContext change)
 at Microsoft.Html.Editor.Tree.TextChangeAnalyzer.DetermineChangeType(TextChangeContext change)
 at Microsoft.Html.Editor.Tree.TreeUpdateTask.OnTextChanges(List`1 textChanges)
 at Microsoft.Html.Editor.Tree.HtmlEditorTree.OnTextBufferChanged(Object sender, TextContentChangedEventArgs e)
 at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler`1 eventHandlers, TArgs args)

It happens with every PHP project. It does not happen when working on .NET projects. The error does not seem to affect behaviour of VS or PHP Tools.

Re: ArgumentOutOfRangeException in VS

PostPosted: April 26th, 2017, 9:07 am
by Michal Brabec
Thank you for feedback.
We have investigated this issue and we suspect that it is caused by a bug in Visual Studio Web Editor.
We will consult Microsoft regarding possible solutions.
Please let us know if you encounter other issues.