Sonarlint crashes Visual Studio on deleting source with sonarlint corrections

visualstudio
sonarlint

(Daniel Pedersen) #1

Hey
Found that sonarlint crashes your Visual Studio 2015 instance when deleting source code while sonarlint recommends changes to the code. See example:

bool test = false;
int test2 = 2;

if(test == test2)
 {
   int g = 2;
}

if(test == test2)
{
   int g = 2;
}

Correct enough sonarlint suggest both to remove g and that the if statement should be reconsidered (after saving file, no green line is present prior to saving source file?). Marking first if statement and pressing backspace, makes VS15 crash:

bool test = false;
int test2 = 2;

*DELETED IF STATEMENT HERE BY MARKING ALL AND BACKSLASH* 

if(test == test2)
{
   int g = 2;
}

Log from Visual Studio indicates:

  <entry>
    <record>654</record>
    <time>2018/09/17 14:05:24.211</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.&#x000D;&#x000A;Parameter name: position&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.SnapshotPoint..ctor(ITextSnapshot snapshot, Int32 position)&#x000D;&#x000A;   at SonarLint.VisualStudio.Integration.Vsix.Helpers.IssueConverter.ToMarker(Issue issue, ITextSnapshot currentSnapshot)&#x000D;&#x000A;   at SonarLint.VisualStudio.Integration.Vsix.SonarLintQuickInfoSource.CreateMarker(Issue issue)&#x000D;&#x000A;   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()&#x000D;&#x000A;   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()&#x000D;&#x000A;   at SonarLint.VisualStudio.Integration.Vsix.SonarLintQuickInfoSource.AugmentQuickInfoSession(IQuickInfoSession session, IList`1 quickInfoContent, ITrackingSpan&amp; applicableToSpan)&#x000D;&#x000A;   at Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoSession.Recalculate()&#x000D;&#x000A;   at Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoSession.Start()&#x000D;&#x000A;   at Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoBroker.TriggerQuickInfo(ITextView textView, ITrackingPoint triggerPoint, Boolean trackMouse)&#x000D;&#x000A;   at SonarLint.VisualStudio.Integration.Vsix.SonarLintQuickInfoController.OnTextViewMouseHover(Object sender, MouseHoverEventArgs e)&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.RaiseHoverEvents()</description>
  </entry>


  <entry>
    <record>655</record>
    <time>2018/09/17 14:05:24.211</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.&#x000D;&#x000A;Parameter name: position&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.SnapshotPoint..ctor(ITextSnapshot snapshot, Int32 position)&#x000D;&#x000A;   at SonarLint.VisualStudio.Integration.Vsix.Helpers.IssueConverter.ToMarker(Issue issue, ITextSnapshot currentSnapshot)&#x000D;&#x000A;   at SonarLint.VisualStudio.Integration.Vsix.SonarLintQuickInfoSource.CreateMarker(Issue issue)&#x000D;&#x000A;   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()&#x000D;&#x000A;   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()&#x000D;&#x000A;   at SonarLint.VisualStudio.Integration.Vsix.SonarLintQuickInfoSource.AugmentQuickInfoSession(IQuickInfoSession session, IList`1 quickInfoContent, ITrackingSpan&amp; applicableToSpan)&#x000D;&#x000A;   at Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoSession.Recalculate()&#x000D;&#x000A;   at Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoSession.Start()&#x000D;&#x000A;   at Microsoft.VisualStudio.Language.Intellisense.Implementation.DefaultQuickInfoController.OnTextView_MouseHover(Object sender, MouseHoverEventArgs e)&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.RaiseHoverEvents()</description>
  </entry>