ScriptAnalyzerQuickFixer fails due to item already being in the hashtable
Issue #22
resolved
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: 'ScriptAnalyzerQuickFixer' Key being added: 'ScriptAnalyzerQuickFixer'
 at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
 at System.Collections.Hashtable.Add(Object key, Object value)
 at System.Collections.Specialized.HybridDictionary.Add(Object key, Object value)
 at Microsoft.VisualStudio.Utilities.PropertyCollection.AddProperty(Object key, Object property)
 at PowerShellTools.QuickFix.ScriptAnalysisSuggestedActionsSourceProvider.CreateSuggestedActionsSource(ITextView textView, ITextBuffer textBuffer)
 at Microsoft.VisualStudio.Language.Intellisense.Implementation.LightBulbBroker.<>c__DisplayClass50_0.<CreateSourcesForBuffer>b__0(ISuggestedActionsSourceProvider provider)
 at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InvokeMatchingFactories[TExtensionInstance,TExtensionFactory,TMetadataView](IEnumerable`1 lazyFactories, Func`2 getter, IContentType dataContentType, Object errorSource)
--- End of stack trace from previous location where exception was thrown ---
 at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)</description>
</entry>
Comments (3)
-
-
Yep. This is definitely a poshtools issue. I'll get it fix in the next version.
-
- changed status to resolved
Fixes
#22→ <<cset dd36e6ad12b2>>
- Log in to comment
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.