roslyn-security-guard
roslyn-security-guard copied to clipboard
System.ArgumentException : An item with the same key has already been added.
Description: Given I have more SG0018 Path Traversal errors When I try to suppress then Solution wide Then I get this exception from you extension:
System.ArgumentException : An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key,TValue value,Boolean add)
at async Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.BatchPragmaFixesAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedSolutionAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedSolutionInternalAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeFixes.BatchFixAllProvider.GetChangedDocumentsAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeFixes.BatchFixAllProvider.GetDocumentIdToChangedDocuments(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeFixes.BatchFixAllProvider.TryMergeFixesAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeFixes.BatchFixAllProvider.TryGetMergedFixAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeFixes.BatchFixAllProvider.GetFixAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider.SuppressionFixAllProvider.GetFixAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.FixAllGetFixesService.GetFixAllCodeActionAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.FixAllGetFixesService.GetFixAllOperationsAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeActions.CodeAction.GetOperationsCoreAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeActions.CodeAction.GetOperationsAsync(<Unknown Parameters>)
at Roslyn.Utilities.TaskExtensions.WaitAndGetResult_CanCallOnBackground[T](Task`1 task,CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedAction.InvokeWorker(Func`1 getFromDocument,IProgressTracker progressTracker,CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedAction.<>c__DisplayClass18_0.<InvokeCore>b__0()
at Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.PerformAction(IExtensionManager extensionManager,Object extension,Action action)
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
Repro:
- Having like 8 SG0018 Path traversal Errors
- From editor, show code suggestion and suppress SG0018 In Source on Solution
- Verify that you got the exception: