Skip to content
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
2 changes: 1 addition & 1 deletion eng/Common.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ dotnet_diagnostic.CA1832.severity = warning
dotnet_diagnostic.CA1833.severity = warning

# Consider using 'StringBuilder.Append(char)' when applicable.
dotnet_diagnostic.CA1834.severity = suggestion
dotnet_diagnostic.CA1834.severity = warning

# Prefer the 'Memory'-based overloads for 'ReadAsync' and 'WriteAsync'
dotnet_diagnostic.CA1835.severity = suggestion
Expand Down
12 changes: 6 additions & 6 deletions src/Build.UnitTests/Evaluation/ProjectStringCache_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public void AddReturnsSameInstanceForSameDocument()
// Build a new string guaranteed not to be optimized by the compiler into the same instance.
StringBuilder builder = new StringBuilder();
builder.Append("Test");
builder.Append("1");
builder.Append('1');

string return2 = cache.Add(builder.ToString(), document);

Expand Down Expand Up @@ -320,7 +320,7 @@ public void AddReturnsSameInstanceForDifferentDocument()
// Build a new string guaranteed not to be optimized by the compiler into the same instance.
StringBuilder builder = new StringBuilder();
builder.Append("Test");
builder.Append("1");
builder.Append('1');
XmlDocument document2 = new XmlDocument();

string return2 = cache.Add(builder.ToString(), document2);
Expand Down Expand Up @@ -362,7 +362,7 @@ public void RemoveLastInstanceDeallocatesEntry()
// Build a new string guaranteed not to be optimized by the compiler into the same instance.
StringBuilder builder = new StringBuilder();
builder.Append("Test");
builder.Append("1");
builder.Append('1');
XmlDocument document2 = new XmlDocument();

string return2 = cache.Add(builder.ToString(), document2);
Expand Down Expand Up @@ -399,7 +399,7 @@ public void RemoveOneInstance()
// Build a new string guaranteed not to be optimized by the compiler into the same instance.
StringBuilder builder = new StringBuilder();
builder.Append("Test");
builder.Append("1");
builder.Append('1');
XmlDocument document3 = new XmlDocument();

string return3 = cache.Add(builder.ToString(), document3);
Expand Down Expand Up @@ -434,7 +434,7 @@ public void DifferentStringsSameDocument()
// Build a new string guaranteed not to be optimized by the compiler into the same instance.
StringBuilder builder = new StringBuilder();
builder.Append("Test");
builder.Append("2");
builder.Append('2');
string return3 = cache.Add(builder.ToString(), document);

// The new string should be the same as the other one already in the collection.
Expand Down Expand Up @@ -468,7 +468,7 @@ public void DifferentStringsDifferentDocuments()
// Build a new string guaranteed not to be optimized by the compiler into the same instance.
StringBuilder builder = new StringBuilder();
builder.Append("Test");
builder.Append("2");
builder.Append('2');
XmlDocument document3 = new XmlDocument();
string return3 = cache.Add(builder.ToString(), document3);

Expand Down
4 changes: 2 additions & 2 deletions src/Build/Construction/Solution/SolutionProjectGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1779,7 +1779,7 @@ private string ComputeTargetConditionForWebProject(ProjectInSolution project)
{
condition.Append(" or (");
condition.Append(GetConditionStringForConfiguration(solutionConfiguration));
condition.Append(")");
condition.Append(')');
}
}
else if (String.Equals(solutionConfiguration.ConfigurationName, "Release", StringComparison.OrdinalIgnoreCase) ||
Expand All @@ -1790,7 +1790,7 @@ private string ComputeTargetConditionForWebProject(ProjectInSolution project)
// so these should be available in the solution project
condition.Append(" or (");
condition.Append(GetConditionStringForConfiguration(solutionConfiguration));
condition.Append(")");
condition.Append(')');
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Build/Graph/ProjectGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ internal string ToDot(
}
}

sb.Append("}");
sb.Append('}');

return sb.ToString();

Expand Down
6 changes: 3 additions & 3 deletions src/Framework/BuildEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,14 @@ private void SetBuildEventContextDefaultAfterSerialization(StreamingContext sc)
{
var sb = new StringBuilder();
sb.Append(resourceName);
sb.Append("(");
sb.Append('(');

bool notFirst = false;
foreach (var argument in arguments)
{
if (notFirst)
{
sb.Append(",");
sb.Append(',');
}
else
{
Expand All @@ -307,7 +307,7 @@ private void SetBuildEventContextDefaultAfterSerialization(StreamingContext sc)
sb.Append(argument);
}

sb.Append(")");
sb.Append(')');
return sb.ToString();
};

Expand Down
4 changes: 2 additions & 2 deletions src/MSBuild/XMake.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ private static void HandleConfigurationException(Exception ex)
// One of the exceptions is missing a period!
if (message[message.Length - 1] != '.')
{
builder.Append(".");
builder.Append('.');
}
builder.Append(" ");
builder.Append(' ');

exception = exception.InnerException;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Shared/ExceptionHandling.cs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ internal static string ReadAnyExceptionFromFile(DateTime fromTimeUtc)
{
builder.Append(Environment.NewLine);
builder.Append(file);
builder.Append(":");
builder.Append(':');
builder.Append(Environment.NewLine);
builder.Append(File.ReadAllText(file));
builder.Append(Environment.NewLine);
Expand Down
2 changes: 1 addition & 1 deletion src/Shared/FileMatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2228,7 +2228,7 @@ internal static string Normalize(string aString)
}
else if (aString.StartsWith(@"\", StringComparison.Ordinal))
{
sb.Append(@"\");
sb.Append('\\');
index = SkipSlashes(aString, 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3618,7 +3618,7 @@ public static string GetTestTextContent(string tagName, string oneLine, bool cle

if (tagName != null)
{
txt.Append("[");
txt.Append('[');
txt.Append(tagName);
txt.Append("]\xd\xa");
}
Expand Down
2 changes: 1 addition & 1 deletion src/Utilities/CommandLineBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ protected void AppendSpaceIfNotEmpty()
}
else if(CommandLine[CommandLine.Length - 1] != ' ')
{
CommandLine.Append(" ");
CommandLine.Append(' ');
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Utilities/ToolLocationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2303,12 +2303,12 @@ public static string GetDisplayNameForTargetFrameworkDirectory(string targetFram
StringBuilder displayNameBuilder = new StringBuilder();

displayNameBuilder.Append(frameworkName.Identifier);
displayNameBuilder.Append(" ");
displayNameBuilder.Append(' ');
displayNameBuilder.Append('v').Append(frameworkName.Version.ToString());

if (!string.IsNullOrEmpty(frameworkName.Profile))
{
displayNameBuilder.Append(" ");
displayNameBuilder.Append(' ');
displayNameBuilder.Append(frameworkName.Profile);
}

Expand Down