mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
C#: Use invariant culture in the extractor
This commit is contained in:
@@ -7,6 +7,8 @@ namespace Semmle.Extraction.CSharp
|
||||
{
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
Extractor.SetInvariantCulture();
|
||||
|
||||
return (int)Extractor.Run(args);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@ namespace Semmle.Extraction.CSharp.Standalone
|
||||
{
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
Extractor.SetInvariantCulture();
|
||||
|
||||
var options = Options.Create(args);
|
||||
// options.CIL = true; // To do: Enable this
|
||||
using var output = new ConsoleLogger(options.Verbosity);
|
||||
|
||||
@@ -11,6 +11,8 @@ using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Semmle.Util.Logging;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
|
||||
namespace Semmle.Extraction.CSharp
|
||||
{
|
||||
@@ -52,6 +54,21 @@ namespace Semmle.Extraction.CSharp
|
||||
public void MissingType(string type) { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the application culture to the invariant culture.
|
||||
///
|
||||
/// This is required among others to ensure that the invariant culture is used for value formatting during TRAP
|
||||
/// file writing.
|
||||
/// </summary>
|
||||
public static void SetInvariantCulture()
|
||||
{
|
||||
var culture = CultureInfo.InvariantCulture;
|
||||
CultureInfo.DefaultThreadCurrentCulture = culture;
|
||||
CultureInfo.DefaultThreadCurrentUICulture = culture;
|
||||
Thread.CurrentThread.CurrentCulture = culture;
|
||||
Thread.CurrentThread.CurrentUICulture = culture;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Command-line driver for the extractor.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user