Skip to content

Command fails when multiple sessions executing at the same time #294

Open
@misterfoo

Description

@misterfoo

We have a test automation suite which runs multiple tests in parallel through Azure DevOps pipelines. These tests call Disable-AzContextAutosave when they start, and when multiple tests start at exactly the same time (in separate Powershell instances) we often get the following error:

Disable-AzContextAutosave : The given key was not present in the dictionary.
At C:\devops_agent_A\_work\_temp\azureclitaskscript1634703545536_inlinescript.ps1:6 char:3
+   Disable-AzContextAutosave -Scope Process | Out-Null
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Disable-AzContextAutosave], KeyNotFoundException
    + FullyQualifiedErrorId : System.Collections.Generic.KeyNotFoundException,Microsoft.Azure.Commands.Profile.Context 
   .DisableAzureRmContextAutosave
 
The given key was not present in the dictionary.
   at System.Collections.Concurrent.ConcurrentDictionary`2.get_Item(TKey key)
   at Microsoft.Azure.PowerShell.Common.Share.Survey.SurveyHelper.ShouldModulePrompt(SurveyHelper helper, String moduleName, Int32 majorVersion)
   at Microsoft.Azure.PowerShell.Common.Share.Survey.SurveyHelper.ShouldFlush(String moduleName, Int32 majorVersion, Func`4 condition, Action`3 updateModule)
   at Microsoft.Azure.PowerShell.Common.Share.Survey.SurveyHelper.ShouldPropmtSurvey(String moduleName, Version moduleVersion)
   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.EndProcessing()
   at System.Management.Automation.CommandProcessorBase.Complete()

We expected these calls to succeed, rather than throwing this exception. It appears that the relevant code lives in this repo but please redirect me if I'm in the wrong place!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions