diff --git a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs index 859aa8ecfe..dd0877710d 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs @@ -184,7 +184,7 @@ namespace System.Management.Automation #endif // format files - internal static readonly List FormatFileNames = new() + internal static readonly string[] FormatFileNames = new string[] { "Certificate.format.ps1xml", "Diagnostics.format.ps1xml", diff --git a/src/System.Management.Automation/engine/InitialSessionState.cs b/src/System.Management.Automation/engine/InitialSessionState.cs index 815f7ea562..05eb871053 100644 --- a/src/System.Management.Automation/engine/InitialSessionState.cs +++ b/src/System.Management.Automation/engine/InitialSessionState.cs @@ -1434,9 +1434,6 @@ namespace System.Management.Automation.Runspaces return iss; } - // Porting note: moved to Platform so we have one list to maintain - private static readonly string[] s_PSCoreFormatFileNames = Platform.FormatFileNames.ToArray(); - private static void IncludePowerShellCoreFormats(InitialSessionState iss) { string psHome = Utils.DefaultPowerShellAppBase; @@ -1446,7 +1443,7 @@ namespace System.Management.Automation.Runspaces } iss.Formats.Clear(); - foreach (var coreFormat in s_PSCoreFormatFileNames) + foreach (var coreFormat in Platform.FormatFileNames) { iss.Formats.Add(new SessionStateFormatEntry(Path.Combine(psHome, coreFormat))); }