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 @@ -283,7 +283,7 @@ dotnet_diagnostic.CA1823.severity = suggestion
dotnet_diagnostic.CA1824.severity = warning

# Avoid zero-length array allocations.
dotnet_diagnostic.CA1825.severity = suggestion
dotnet_diagnostic.CA1825.severity = warning

# Do not use Count() or LongCount() when Any() can be used
dotnet_diagnostic.CA1827.severity = suggestion
Expand Down
6 changes: 3 additions & 3 deletions src/Build.OM.UnitTests/Definition/ProjectItem_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ public void IncludeAndExcludeWorkWithRelativeAndAbsolutePaths(
var formattedProject = string.Format(projectContents, include, exclude);
File.WriteAllText(projectFile, formattedProject);

var expectedInclude = includeSurvivesExclude ? new[] { include } : new string[0];
var expectedInclude = includeSurvivesExclude ? new[] { include } : Array.Empty<string>();

ObjectModelHelpers.AssertItems(expectedInclude, new Project(projectFile).Items.ToList());
}
Expand Down Expand Up @@ -3425,7 +3425,7 @@ public static IEnumerable<Object[]> UpdateAndRemoveShouldWorkWithEscapedCharacte
public void UpdateAndRemoveShouldWorkWithEscapedCharacters(string projectContents, string include, string update, string remove, string[] expectedInclude, Dictionary<string, string>[] expectedMetadata)
{
var formattedProjectContents = string.Format(projectContents, include, update, remove);
ObjectModelHelpers.AssertItemEvaluationFromProject(formattedProjectContents, new string[0], expectedInclude, expectedMetadata);
ObjectModelHelpers.AssertItemEvaluationFromProject(formattedProjectContents, Array.Empty<string>(), expectedInclude, expectedMetadata);
}

[Fact]
Expand Down Expand Up @@ -3458,7 +3458,7 @@ public void UpdateAndRemoveShouldNotUseGlobMatchingOnEscapedGlobsFromReferencedI
.ToList();
},
project,
inputFiles: new string[0],
inputFiles: Array.Empty<string>(),
expectedInclude: new[] { "1.cs", "2.js" },
expectedMetadataPerItem: null
);
Expand Down
8 changes: 4 additions & 4 deletions src/Build.OM.UnitTests/Definition/Project_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3247,7 +3247,7 @@ public void GetItemProvenanceMatchesLiteralsWithNonCanonicPaths()
using (var env = TestEnvironment.Create())
{
var projectCollection = env.CreateProjectCollection().Collection;
var testFiles = env.CreateTestProjectWithFiles(projectContents, new string[0], "u/x");
var testFiles = env.CreateTestProjectWithFiles(projectContents, Array.Empty<string>(), "u/x");
var project = new Project(testFiles.ProjectFile, new Dictionary<string, string>(), MSBuildConstants.CurrentToolsVersion, projectCollection);

var expected2Foo = new ProvenanceResultTupleList
Expand Down Expand Up @@ -3276,7 +3276,7 @@ public void GetItemProvenanceMatchesAbsoluteAndRelativePaths()
{
var projectCollection = env.CreateProjectCollection().Collection;

var testFiles = env.CreateTestProjectWithFiles(projectContents, new string[0]);
var testFiles = env.CreateTestProjectWithFiles(projectContents, Array.Empty<string>());

var project = new Project(testFiles.ProjectFile, new Dictionary<string, string>(), MSBuildConstants.CurrentToolsVersion, projectCollection);

Expand Down Expand Up @@ -3568,7 +3568,7 @@ public void GetItemProvenanceShouldBeSensitiveToGlobbingCone(string includeGlob,
using (var env = TestEnvironment.Create())
using (var projectCollection = new ProjectCollection())
{
var testFiles = env.CreateTestProjectWithFiles(projectContents, new string[0], relativePathOfProjectFile);
var testFiles = env.CreateTestProjectWithFiles(projectContents, Array.Empty<string>(), relativePathOfProjectFile);
var project = new Project(testFiles.ProjectFile, new Dictionary<string, string>(), MSBuildConstants.CurrentToolsVersion, projectCollection);

ProvenanceResultTupleList expectedProvenance = null;
Expand Down Expand Up @@ -3764,7 +3764,7 @@ public void GetAllGlobsShouldProduceGlobsThatMatchAbsolutePaths()
{
var projectCollection = env.CreateProjectCollection().Collection;

var testFiles = env.CreateTestProjectWithFiles(projectContents, new string[0]);
var testFiles = env.CreateTestProjectWithFiles(projectContents, Array.Empty<string>());

var project = new Project(testFiles.ProjectFile, new Dictionary<string, string>(), MSBuildConstants.CurrentToolsVersion, projectCollection);

Expand Down
4 changes: 2 additions & 2 deletions src/Build.OM.UnitTests/Instance/ProjectInstance_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,13 @@ public void BuildProjectInstancesConsecutively()
{
ProjectInstance instance1 = new Project().CreateProjectInstance();

BuildRequestData buildRequestData1 = new BuildRequestData(instance1, new string[] { });
BuildRequestData buildRequestData1 = new BuildRequestData(instance1, Array.Empty<string>());

BuildManager.DefaultBuildManager.Build(new BuildParameters(), buildRequestData1);

new Project().CreateProjectInstance();

BuildRequestData buildRequestData2 = new BuildRequestData(instance1, new string[] { });
BuildRequestData buildRequestData2 = new BuildRequestData(instance1, Array.Empty<string>());

BuildManager.DefaultBuildManager.Build(new BuildParameters(), buildRequestData2);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Build.UnitTests/BackEnd/BinaryTranslator_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void TestSerializeString()
[Fact]
public void TestSerializeStringArray()
{
HelperTestArray(new string[] { }, StringComparer.Ordinal);
HelperTestArray(Array.Empty<string>(), StringComparer.Ordinal);
HelperTestArray(new string[] { "foo", "bar" }, StringComparer.Ordinal);
HelperTestArray(null, StringComparer.Ordinal);
}
Expand Down
Loading