Skip to content

Commit

Permalink
Print diagnostics in invariant culture (English error messages) in as…
Browse files Browse the repository at this point in the history
…sert text (#72816)
  • Loading branch information
DoctorKrolic committed Apr 2, 2024
1 parent 337f1a6 commit c0d5ee2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Compilers/Test/Core/Diagnostics/DiagnosticDescription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
using Xunit;
using Roslyn.Test.Utilities;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.CSharp;
using System.Collections.Immutable;

namespace Microsoft.CodeAnalysis.Test.Utilities
{
Expand Down Expand Up @@ -518,7 +519,7 @@ public static string GetAssertText(DiagnosticDescription[] expected, IEnumerable
for (i = 0; e.MoveNext(); i++)
{
Diagnostic d = e.Current;
string message = d.ToString();
string message = d.ToString(CultureInfo.InvariantCulture);
if (Regex.Match(message, @"{\d+}").Success)
{
Assert.True(false, "Diagnostic messages should never contain unsubstituted placeholders.\n " + message);
Expand All @@ -533,7 +534,7 @@ public static string GetAssertText(DiagnosticDescription[] expected, IEnumerable
{
Indent(assertText, indentDepth);
assertText.Append("// ");
assertText.AppendLine(d.ToString());
assertText.AppendLine(message);
var l = d.Location;
if (l.IsInSource)
{
Expand Down

0 comments on commit c0d5ee2

Please sign in to comment.