Skip to content

AccessViolationException in System.Globalization on ARM64 (Huawei Kunpeng) with .NET 8 #126039

@AlexKuai

Description

@AlexKuai

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Description
A System.AccessViolationException occurs when running an ASP.NET Core application on Huawei Kunpeng (ARM64) using .NET 8. The crash consistently happens during the application startup phase, specifically during configuration binding and logging initialization.

Error Message & Stack Trace

Fatal error. System.AccessViolationException: Attempted to read or write protected memory.
at System.Globalization.NumberFormatInfo.get_CurrentInfo()
at System.Int32.TryParse(ReadOnlySpan s, Int32& result)
at Microsoft.Extensions.Configuration.ConfigurationKeyComparer.Compare(String x, String y)
...
at Microsoft.Extensions.Hosting.HostApplicationBuilder.Build()
at Program.

$(String[] args)

Environment
.NET SDK/Runtime: 8.0
Architecture: ARM64 (AArch64)
CPU: Huawei Kunpeng 920
OS: Kylin Server V10 SP3

Observed Behavior
The application fails with a fatal AccessViolationException when the ConfigurationKeyComparer attempts to parse a string to an integer, which calls into NumberFormatInfo.get_CurrentInfo().

Additional Context
The issue seems related to how .NET 8 interacts with the system's ICU library on this specific ARM64 platform.
Temporary Workaround: Setting DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 is not resolving the issue.

Expected Behavior

The application should start normally without memory access violations.

Steps To Reproduce

Create a standard ASP.NET Core 8.0 Web API project.

Deploy and run the application on a Huawei Kunpeng ARM64 server.

The application crashes during builder.Build().

Exceptions (if any)

No response

.NET Version

8.0.6

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions