Skip to content

System.Globalization.CultureData.GetNFIValues throws System.IndexOutOfRangeException: Index was outside the bounds of the array #35407

@iSazonov

Description

@iSazonov

In PowerShell repo we get a report with stack trace:
PowerShell/PowerShell#12476

Unhandled exception. System.TypeInitializationException: The type initializer for 'System.Management.Automation.Tracing.PSEtwLog' threw an exception.
---> System.TypeInitializationException: The type initializer for 'System.Management.Automation.Tracing.PSEtwLogProvider' threw an exception.
---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Globalization.CultureData.GetNFIValues(NumberFormatInfo nfi)
at System.Globalization.NumberFormatInfo..ctor(CultureData cultureData)
at System.Globalization.CultureInfo.get_NumberFormat()
at System.Globalization.CultureInfo.GetFormat(Type formatType)
at System.Globalization.NumberFormatInfo.get_CurrentInfo()
at System.Guid.TryParseExactD(ReadOnlySpan`1 guidString, GuidResult& result)
at System.Guid.TryParseGuid(ReadOnlySpan`1 guidString, GuidResult& result)
at System.Guid..ctor(String g)
at System.Management.Automation.Tracing.PSEtwLogProvider..cctor()
--- End of inner exception stack trace ---
at System.Management.Automation.Tracing.PSEtwLog..cctor()
--- End of inner exception stack trace ---
at System.Management.Automation.Tracing.PSEtwLog.LogConsoleStartup()
at Microsoft.PowerShell.UnmanagedPSEntry.Start(String consoleFilePath, String[] args, Int32 argc)
at Microsoft.PowerShell.ManagedPSEntry.Main(String[] args)

I tried to reproduce without success. I don't know whether the issue in in .Net or OS (Windows Server 2016). Cuture 1053 sv-SE Swedish (Sweden).

I guess the Guid ctor is called in follow code:

        internal static readonly Guid ProviderGuid = new Guid("F90714A8-5509-434A-BF6D-B1624C8A19A2");

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions