Skip to content

PS7 should revert to defaults if it can't load user powershell.config.json #27370

Description

Prerequisites

Steps to reproduce

There's a race condition when starting a machine where OneDrive isn't running yet, but you start pwsh

Expected behavior

PS7 starts, perhaps a warning message that it's using defaults (including `$profile`)

Actual behavior

PS7 fails to start

Error details

Unhandled exception. System.Management.Automation.PSInvalidOperationException: PowerShell has stopped working because of a security issue: Cannot read the configuration file: C:\Users\bburns\OneDrive - Microsoft\Documents\PowerShell\powershell.config.json
---> System.IO.IOException: The cloud file provider is not running. : 'C:\Users\bburns\OneDrive - Microsoft\Documents\PowerShell\powershell.config.json'.
   at System.IO.RandomAccess.ReadAtOffset(SafeFileHandle handle, Span`1 buffer, Int64 fileOffset)
   at System.IO.Strategies.OSFileStreamStrategy.Read(Span`1 buffer)
   at System.IO.Strategies.BufferedFileStreamStrategy.ReadSpan(Span`1 destination, ArraySegment`1 arraySegment)
   at System.IO.StreamReader.ReadBuffer(Span`1 userBuffer, Boolean& readToUserBuffer)
   at System.IO.StreamReader.ReadSpan(Span`1 buffer)
   at Newtonsoft.Json.JsonTextReader.ReadData(Boolean append, Int32 charsRequired)
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
   at System.Management.Automation.Configuration.PowerShellConfig.ReadValueFromFile[T](ConfigScope scope, String key, T defaultValue)
   --- End of inner exception stack trace ---
   at System.Management.Automation.Configuration.PowerShellConfig.ReadValueFromFile[T](ConfigScope scope, String key, T defaultValue)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at System.Management.Automation.Utils.GetPolicySettingFromConfigFile[T](ConfigScope[] preferenceOrder)
   at System.Management.Automation.Utils.GetPolicySetting[T](ConfigScope[] preferenceOrder)
   at Microsoft.PowerShell.CommandLineParameterParser.GetConfigurationNameFromGroupPolicy()
   at Microsoft.PowerShell.ConsoleHost.ParseCommandLine(String[] args)
   at Microsoft.PowerShell.UnmanagedPSEntry.Start(String[] args, Int32 argc)
   at Microsoft.PowerShell.ManagedPSEntry.Main(String[] args)

[process exited with code 3762504530 (0xe0434352)]
You can now close this terminal with Ctrl+D, or press Enter to restart.

Environment data

7.6.1

Visuals

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Issue-BugIssue has been identified as a bug in the product

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions