From 34394116fffff7e46fdc84cf77ab1387e20cecd0 Mon Sep 17 00:00:00 2001 From: Ilya Date: Sun, 10 Mar 2019 06:57:51 +0500 Subject: [PATCH] Add retry logic to the operation that updates 'powershell.config.json' (#8779) --- src/System.Management.Automation/engine/PSConfiguration.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Management.Automation/engine/PSConfiguration.cs b/src/System.Management.Automation/engine/PSConfiguration.cs index d12f5616de..630bda9333 100644 --- a/src/System.Management.Automation/engine/PSConfiguration.cs +++ b/src/System.Management.Automation/engine/PSConfiguration.cs @@ -459,7 +459,7 @@ namespace System.Management.Automation.Configuration // prevents other processes from reading or writing the file while // the update is in progress. It also locks out readers during write // operations. - using (FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None)) + using (FileStream fs = WaitForFile(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None)) { JObject jsonObject = null;