Skip to content

Commit

Permalink
Use en-US culture when getting error messages so builds work when dis…
Browse files Browse the repository at this point in the history
…play language isn't English

Fixes #315
  • Loading branch information
Steve Otteson committed Mar 15, 2021
1 parent e513c1e commit d04d3a8
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public static ClangSharpSourceCompilation Create(
public ReadOnlyCollection<Diagnostic> GetDiagnostics()
{
List<Diagnostic> diags = new List<Diagnostic>();
var culture = new System.Globalization.CultureInfo("en-US");

foreach (var diag in this.compilation.GetDeclarationDiagnostics())
{
Expand Down Expand Up @@ -152,7 +153,7 @@ public ReadOnlyCollection<Diagnostic> GetDiagnostics()
if (diag.Id == "CS0246")
{
var symbolNameRegx = new System.Text.RegularExpressions.Regex(@"The type or namespace name '(\w+)'");
var match = symbolNameRegx.Match(diag.GetMessage());
var match = symbolNameRegx.Match(diag.GetMessage(culture));
if (match.Success)
{
var symbolName = match.Groups[1].Value;
Expand Down

0 comments on commit d04d3a8

Please sign in to comment.