Skip to content
14 changes: 14 additions & 0 deletions src/HotChocolate/Core/test/Types.Analyzers.Tests/TestHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Json;
Expand Down Expand Up @@ -314,4 +316,16 @@ private static void AddDiagnosticsToSnapshot(

[GeneratedRegex("MiddlewareFactories([a-z0-9]{32})")]
private static partial Regex MiddlewareFactoryHashRegex();

internal static class ForceInvariantDefaultCultureModuleInitializer
{
[ModuleInitializer]
internal static void Initialize()
{
// Compile errors are localized, so enforce a common default culture,
// since otherwise the snapshot comparison may fail
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;
}
}
}