Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forcibly sets "en-US" locale. #33291

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

<ItemGroup>
<Compile Include="..\..\src\Shared\MemberInfoExtensions.cs" Link="MemberInfoExtensions.cs" />
<Compile Include="..\Shared\ModuleInitializer.cs" Link="ModuleInitializer.cs" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
<None Include="Scaffolding\Baselines\**\*" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\Shared\ModuleInitializer.cs" Link="ModuleInitializer.cs" />
</ItemGroup>

<ItemGroup>
<Using Include="System.Data.Common" />
<Using Include="System.Diagnostics" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
<None Include="Scaffolding\Baselines\**\*" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\Shared\ModuleInitializer.cs" Link="ModuleInitializer.cs" />
</ItemGroup>

<ItemGroup>
<Using Include="System.Data.Common" />
<Using Include="System.Diagnostics" />
Expand Down
4 changes: 4 additions & 0 deletions test/EFCore.Tests/EFCore.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
</AssemblyAttribute>
</ItemGroup>

<ItemGroup>
<Compile Include="..\Shared\ModuleInitializer.cs" Link="ModuleInitializer.cs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\EFCore.InMemory.FunctionalTests\EFCore.InMemory.FunctionalTests.csproj" />
<ProjectReference Include="..\EFCore.Specification.Tests\EFCore.Specification.Tests.csproj" />
Expand Down
23 changes: 23 additions & 0 deletions test/Shared/ModuleInitializer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Globalization;
using System.Runtime.CompilerServices;

internal static class ModuleInitializer
{
[ModuleInitializer]
internal static void Initialize()
{
InitializeLocale();
}

private static void InitializeLocale()
{
var culture = new CultureInfo("en-US");
CultureInfo.DefaultThreadCurrentCulture = culture;
CultureInfo.DefaultThreadCurrentUICulture = culture;
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
}
}
Loading