ScriptAnalyzerQuickFixer fails due to item already being in the hashtable

Issue #22 resolved
Former user created an issue

An exception is thrown in Visual Studio from the ScriptAnalyzerQuickFixer while trying to add an item which has already been added to the HashTable.

I am able to consistently replicate this by reopening the solution and clicking "show changes" from the AnkhSVN extension. This appears to be if there is any change to the file.

I am running:

Visual Studio Professional 2017 (15.8.9)

Powershell Tools for visual studio 2017 (4.0.19)

AnkhSVN (2.7.12815)

The entry in the Activity Log is:

<entry>
   <record>965</record>
   <time>2018/11/12 10:42:04.513</time>
   <type>Error</type>
   <source>Editor or Editor Extension</source>
   <description>System.ArgumentException: Item has already been added. Key in dictionary: &apos;ScriptAnalyzerQuickFixer&apos;  Key being added: &apos;ScriptAnalyzerQuickFixer&apos;&#x000D;&#x000A;   at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)&#x000D;&#x000A;   at System.Collections.Hashtable.Add(Object key, Object value)&#x000D;&#x000A;   at System.Collections.Specialized.HybridDictionary.Add(Object key, Object value)&#x000D;&#x000A;   at Microsoft.VisualStudio.Utilities.PropertyCollection.AddProperty(Object key, Object property)&#x000D;&#x000A;   at PowerShellTools.QuickFix.ScriptAnalysisSuggestedActionsSourceProvider.CreateSuggestedActionsSource(ITextView textView, ITextBuffer textBuffer)&#x000D;&#x000A;   at Microsoft.VisualStudio.Language.Intellisense.Implementation.LightBulbBroker.&lt;&gt;c__DisplayClass50_0.&lt;CreateSourcesForBuffer&gt;b__0(ISuggestedActionsSourceProvider provider)&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InvokeMatchingFactories[TExtensionInstance,TExtensionFactory,TMetadataView](IEnumerable`1 lazyFactories, Func`2 getter, IContentType dataContentType, Object errorSource)&#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>

Comments (3)

  1. Christoph Bergmeister [MVP]

    Note that this bug has been redirected from here, feel free to re-open the issue if it turns to be a problem of scriptanalyzer itself with details on how to repro.

  2. Log in to comment