- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.2k
Description
Description
Hi we are having issues with ICU after installing the new .NET 6 SDK v6.0.402
using specific Compare options fails with System.AccessValidationException
We are using up to date versions of Windows 10 and Windows 11 and the same error happens on both with the latest .NET SDK updates.
If ICU settings are disabled everything behaves as normal
Reproduction Steps
Setup a new .NET 6 console project with the following files
Repro.csproj
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="68.2.0.9" />
    <RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="68.2.0.9" />
  </ItemGroup>
</Project>Program.cs
using System.Globalization;
CultureInfo.GetCultureInfo("en-US").CompareInfo.Compare("sample", "Sample", CompareOptions.IgnoreSymbols);Expected behavior
No System.AccessViolationException are thrown and the program exists with status code 0
Actual behavior
System.AccessViolationException is thrown or Windows Security Exploit Protection kills the program if Control flow guard (CFG) is enabled
Regression?
With the previous version of the SDK everything worked as espected
Known Workarounds
Remove ICU settings
<RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="68.2.0.9" />
Configuration
.NET SDK v6.0.402
.NET Runtime v6.0.10
Architecture: x64
Windows 10 and 11 both fully updated
Specific on my machine: Version 21H2 (OS Build 190444.2130)
Other information
No response