madskristensen / Tweakster

A Visual Studio extension
Apache License 2.0
241 stars 23 forks source link

ArgumentOutOfRangeException when saving changes to GlobalSuppressions file. #19

Closed AdamCaviness closed 4 years ago

AdamCaviness commented 4 years ago

You deserve serious credit for the community contributions and youtube content you create; I'm always impressed. Tweakster is great. Thank you!

I hit an ArgumentOutOfRange exception quite a bit since installing Tweakster. I often add items to a GlobalSuppressions.cs file for any number of suggestions that VS provides. This error is thrown when modifying a recently opened GlobalSuppressions file once I have made changes.

Detailed Description:

I use CodeRush to invoke it's context menu which includes both CodeRush and VS suggestions (Ctrl+~). I then navigate by keyboard to the VS suggestion to suppress the issue into a GlobalSupression.cs file. The GlobalSuppression file is opened and I navigate to the text and enter my reason for the suppression and the exception is thrown.

By reading the ActivityLog I can see the exception is thrown in CollapseAttributeTagger. I am therefore able to work around this issue by disabling "Enable collapsing attributes" in the Tweaks options page.

Screencast

https://drive.google.com/file/d/1HtggRt6IncTtoVxZwK6Uox7P83A9fHYU/view

Relevant ActivityLog section:

  <entry>
    <record>1189</record>
    <time>2020/08/12 12:45:45.462</time>
    <type>Information</type>
    <source>MruList</source>
    <description>Entering AddItem. Persistence data for item: C:\Users\AdamCaviness\source\repos\SouthernSoftwarePlatform\Source\SS.Core.Client.Services\Common\PrimaryFieldService.cs|00000000-0000-0000-0000-000000000000|0,0</description>
  </entry>
  <entry>
    <record>1190</record>
    <time>2020/08/12 12:45:45.462</time>
    <type>Information</type>
    <source>MruList</source>
    <description>Entering TryPromoteItem</description>
  </entry>
  <entry>
    <record>1191</record>
    <time>2020/08/12 12:45:45.462</time>
    <type>Information</type>
    <source>MruList</source>
    <description>Entering PromoteItemAt and found the index of the item to be 1</description>
  </entry>
  <entry>
    <record>1192</record>
    <time>2020/08/12 12:46:37.573</time>
    <type>Information</type>
    <source>MruList</source>
    <description>Entering AddItem. Persistence data for item: C:\Users\AdamCaviness\source\repos\SouthernSoftwarePlatform\Source\SS.Core.Client.Services\GlobalSuppressions.cs|00000000-0000-0000-0000-000000000000|0,0</description>
  </entry>
  <entry>
    <record>1193</record>
    <time>2020/08/12 12:46:41.861</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: span&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.SnapshotSpan..ctor(ITextSnapshot snapshot, Span span)&#x000D;&#x000A;   at Tweakster.CollapseAttributeTagger.&lt;GetTags&gt;d__10.MoveNext() in C:\projects\tweakster\src\Tweaks\Editor\CollapseAttributeTagger.cs:line 47&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.&lt;GetTagsForBuffer&gt;d__47.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)</description>
  </entry>

Thank you!