Skip to content

Commit 50fd7fb

Browse files
authored
Simplify string in evaluator (#11819)
This matches our preferred modern style. Happened to be in this file and was bothered.
2 parents e39a91c + 847861c commit 50fd7fb

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/Build/Evaluation/Evaluator.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,11 @@ private Evaluator(
264264
_sdkResolverService = sdkResolverService;
265265
_submissionId = submissionId;
266266
_evaluationProfiler = new EvaluationProfiler(profileEvaluation);
267-
_isRunningInVisualStudio = String.Equals("true", _data.GlobalPropertiesDictionary.GetProperty("BuildingInsideVisualStudio")?.EvaluatedValue, StringComparison.OrdinalIgnoreCase);
267+
_isRunningInVisualStudio = string.Equals("true", _data.GlobalPropertiesDictionary.GetProperty("BuildingInsideVisualStudio")?.EvaluatedValue, StringComparison.OrdinalIgnoreCase);
268268

269269
// In 15.9 we added support for the global property "NuGetInteractive" to allow SDK resolvers to be interactive.
270270
// In 16.0 we added the /interactive command-line argument so the line below keeps back-compat
271-
_interactive = interactive || String.Equals("true", _data.GlobalPropertiesDictionary.GetProperty("NuGetInteractive")?.EvaluatedValue, StringComparison.OrdinalIgnoreCase);
271+
_interactive = interactive || string.Equals("true", _data.GlobalPropertiesDictionary.GetProperty("NuGetInteractive")?.EvaluatedValue, StringComparison.OrdinalIgnoreCase);
272272

273273
// The last modified project is the project itself unless its an in-memory project
274274
if (projectRootElement.FullPath != null)
@@ -626,7 +626,7 @@ private static ProjectTargetInstance ReadNewTargetElement(ProjectTargetElement t
626626
/// </summary>
627627
private void Evaluate()
628628
{
629-
string projectFile = String.IsNullOrEmpty(_projectRootElement.ProjectFileLocation.File) ? "(null)" : _projectRootElement.ProjectFileLocation.File;
629+
string projectFile = string.IsNullOrEmpty(_projectRootElement.ProjectFileLocation.File) ? "(null)" : _projectRootElement.ProjectFileLocation.File;
630630
using (_evaluationProfiler.TrackPass(EvaluationPass.TotalEvaluation))
631631
{
632632
ErrorUtilities.VerifyThrow(_data.EvaluationId == BuildEventContext.InvalidEvaluationId, "There is no prior evaluation ID. The evaluator data needs to be reset at this point");
@@ -812,15 +812,15 @@ private void Evaluate()
812812

813813
foreach (var entry in _data.GlobalPropertiesDictionary)
814814
{
815-
if (!String.Equals(entry.Name, "currentsolutionconfigurationcontents", StringComparison.OrdinalIgnoreCase))
815+
if (!string.Equals(entry.Name, "currentsolutionconfigurationcontents", StringComparison.OrdinalIgnoreCase))
816816
{
817817
propertyDump += $"{entry.Name}={entry.EvaluatedValue}\n";
818818
}
819819
}
820820

821821
string line = new string('#', 100) + "\n";
822822

823-
string output = String.Format(CultureInfo.CurrentUICulture, "###: MSBUILD: Evaluating or reevaluating project {0} with {1} global properties and {2} tools version, child count {3}, CurrentSolutionConfigurationContents hash {4} other properties:\n{5}", _projectRootElement.FullPath, globalPropertiesCount, _data.Toolset.ToolsVersion, _projectRootElement.Count, hash, propertyDump);
823+
string output = string.Format(CultureInfo.CurrentUICulture, "###: MSBUILD: Evaluating or reevaluating project {0} with {1} global properties and {2} tools version, child count {3}, CurrentSolutionConfigurationContents hash {4} other properties:\n{5}", _projectRootElement.FullPath, globalPropertiesCount, _data.Toolset.ToolsVersion, _projectRootElement.Count, hash, propertyDump);
824824

825825
Trace.WriteLine(line + output + line);
826826
}
@@ -1123,10 +1123,10 @@ private void ValidateChangeWaveState()
11231123
switch (ChangeWaves.ConversionState)
11241124
{
11251125
case ChangeWaveConversionState.InvalidFormat:
1126-
_evaluationLoggingContext.LogWarning("", new BuildEventFileInfo(""), "ChangeWave_InvalidFormat", Traits.Instance.MSBuildDisableFeaturesFromVersion, $"[{String.Join(", ", ChangeWaves.AllWaves.Select(x => x.ToString()))}]");
1126+
_evaluationLoggingContext.LogWarning("", new BuildEventFileInfo(""), "ChangeWave_InvalidFormat", Traits.Instance.MSBuildDisableFeaturesFromVersion, $"[{string.Join(", ", ChangeWaves.AllWaves.Select(x => x.ToString()))}]");
11271127
break;
11281128
case ChangeWaveConversionState.OutOfRotation:
1129-
_evaluationLoggingContext.LogWarning("", new BuildEventFileInfo(""), "ChangeWave_OutOfRotation", ChangeWaves.DisabledWave, Traits.Instance.MSBuildDisableFeaturesFromVersion, $"[{String.Join(", ", ChangeWaves.AllWaves.Select(x => x.ToString()))}]");
1129+
_evaluationLoggingContext.LogWarning("", new BuildEventFileInfo(""), "ChangeWave_OutOfRotation", ChangeWaves.DisabledWave, Traits.Instance.MSBuildDisableFeaturesFromVersion, $"[{string.Join(", ", ChangeWaves.AllWaves.Select(x => x.ToString()))}]");
11301130
break;
11311131
}
11321132
}
@@ -1169,9 +1169,9 @@ private void AddBuiltInProperties()
11691169
SetBuiltInProperty(ReservedPropertyNames.msbuildRuntimeType, "Full");
11701170
#endif
11711171

1172-
if (String.IsNullOrEmpty(_projectRootElement.FullPath))
1172+
if (string.IsNullOrEmpty(_projectRootElement.FullPath))
11731173
{
1174-
SetBuiltInProperty(ReservedPropertyNames.projectDirectory, String.IsNullOrEmpty(_projectRootElement.DirectoryPath) ?
1174+
SetBuiltInProperty(ReservedPropertyNames.projectDirectory, string.IsNullOrEmpty(_projectRootElement.DirectoryPath) ?
11751175
// If this is an un-saved project, this is as far as we can go
11761176
startupDirectory :
11771177
// Solution files based on the old OM end up here. But they do have a location, which is where the solution was loaded from.
@@ -1579,7 +1579,7 @@ private List<ProjectRootElement> ExpandAndLoadImports(string directoryOfImportin
15791579

15801580
_evaluationLoggingContext.LogComment(MessageImportance.Low, "SearchPathsForMSBuildExtensionsPath",
15811581
extensionPropertyRefAsString,
1582-
String.Join(";", pathsToSearch));
1582+
string.Join(";", pathsToSearch));
15831583

15841584
bool atleastOneExactFilePathWasLookedAtAndNotFound = false;
15851585

@@ -1995,7 +1995,7 @@ private LoadImportsResult ExpandAndLoadImportsFromUnescapedImportExpression(stri
19951995
string importExpressionEscaped = _expander.ExpandIntoStringLeaveEscaped(unescapedExpression, ExpanderOptions.ExpandProperties, importElement.ProjectLocation);
19961996
ElementLocation importLocationInProject = importElement.Location;
19971997

1998-
if (String.IsNullOrWhiteSpace(importExpressionEscaped))
1998+
if (string.IsNullOrWhiteSpace(importExpressionEscaped))
19991999
{
20002000
if ((_loadSettings & ProjectLoadSettings.IgnoreInvalidImports) != 0)
20012001
{
@@ -2021,7 +2021,7 @@ private LoadImportsResult ExpandAndLoadImportsFromUnescapedImportExpression(stri
20212021
return LoadImportsResult.ImportExpressionResolvedToNothing;
20222022
}
20232023

2024-
ProjectErrorUtilities.ThrowInvalidProject(importLocationInProject, "InvalidAttributeValue", String.Empty, XMakeAttributes.project, XMakeElements.import);
2024+
ProjectErrorUtilities.ThrowInvalidProject(importLocationInProject, "InvalidAttributeValue", string.Empty, XMakeAttributes.project, XMakeElements.import);
20252025
}
20262026

20272027
bool atleastOneImportIgnored = false;
@@ -2101,7 +2101,7 @@ private LoadImportsResult ExpandAndLoadImportsFromUnescapedImportExpression(stri
21012101

21022102
// If a file is included twice, or there is a cycle of imports, we ignore all but the first import
21032103
// and issue a warning to that effect.
2104-
if (String.Equals(_projectRootElement.FullPath, importFileUnescaped, StringComparison.OrdinalIgnoreCase) /* We are trying to import ourselves */)
2104+
if (string.Equals(_projectRootElement.FullPath, importFileUnescaped, StringComparison.OrdinalIgnoreCase) /* We are trying to import ourselves */)
21052105
{
21062106
_evaluationLoggingContext.LogWarning(null, new BuildEventFileInfo(importLocationInProject), "SelfImport", importFileUnescaped);
21072107
atleastOneImportIgnored = true;
@@ -2118,7 +2118,7 @@ private LoadImportsResult ExpandAndLoadImportsFromUnescapedImportExpression(stri
21182118
if (IntroducesCircularity(importFileUnescaped, importElement))
21192119
{
21202120
// Get the full path of the MSBuild file that has this import.
2121-
string importedBy = importElement.ContainingProject.FullPath ?? String.Empty;
2121+
string importedBy = importElement.ContainingProject.FullPath ?? string.Empty;
21222122

21232123
_evaluationLoggingContext.LogWarning(null, new BuildEventFileInfo(importLocationInProject), "ImportIntroducesCircularity", importFileUnescaped, importedBy);
21242124

@@ -2139,7 +2139,7 @@ private LoadImportsResult ExpandAndLoadImportsFromUnescapedImportExpression(stri
21392139

21402140
if (_importsSeen.TryGetValue(importFileUnescaped, out previouslyImportedAt))
21412141
{
2142-
string parenthesizedProjectLocation = String.Empty;
2142+
string parenthesizedProjectLocation = string.Empty;
21432143

21442144
// If neither file involved is the project itself, append its path in square brackets
21452145
if (previouslyImportedAt.ContainingProject != _projectRootElement && importElement.ContainingProject != _projectRootElement)
@@ -2371,14 +2371,14 @@ private bool IntroducesCircularity(string importFileUnescaped, ProjectImportElem
23712371
// Get the full path of the MSBuild file that imports this file.
23722372
string importedBy = importElement.ContainingProject.FullPath;
23732373

2374-
if (String.Equals(importFileUnescaped, importedBy, StringComparison.OrdinalIgnoreCase))
2374+
if (string.Equals(importFileUnescaped, importedBy, StringComparison.OrdinalIgnoreCase))
23752375
{
23762376
// Circular dependency found!
23772377
foundMatchingAncestor = true;
23782378
break;
23792379
}
23802380

2381-
if (!String.IsNullOrEmpty(importedBy)) // The full path of a project loaded from memory can be null.
2381+
if (!string.IsNullOrEmpty(importedBy)) // The full path of a project loaded from memory can be null.
23822382
{
23832383
// Set the "counter" to the importing project.
23842384
_importsSeen.TryGetValue(importedBy, out importElement);

0 commit comments

Comments
 (0)