Azure / Azure/azure-powershell-common

Command fails when multiple sessions executing at the same time

Open
#294 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
36
Forks
62
PR merge metrics
No merged PRs in 30d

Description

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!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.