diff --git a/src/Build/BackEnd/BuildManager/BuildRequestData.cs b/src/Build/BackEnd/BuildManager/BuildRequestData.cs index a49b1aebd32..11f54ffbade 100644 --- a/src/Build/BackEnd/BuildManager/BuildRequestData.cs +++ b/src/Build/BackEnd/BuildManager/BuildRequestData.cs @@ -144,7 +144,7 @@ public BuildRequestData(string projectFullPath, IDictionary glo public BuildRequestData(string projectFullPath, IDictionary globalProperties, string? toolsVersion, string[] targetsToBuild, HostServices? hostServices, BuildRequestDataFlags flags) : this(targetsToBuild, hostServices, flags, FileUtilities.NormalizePath(projectFullPath)!) { - ErrorUtilities.VerifyThrowArgumentLength(projectFullPath, nameof(projectFullPath)); + ErrorUtilities.VerifyThrowArgumentLength(projectFullPath); ErrorUtilities.VerifyThrowArgumentNull(globalProperties); GlobalPropertiesDictionary = new PropertyDictionary(globalProperties.Count); diff --git a/src/Build/BackEnd/Components/ProjectCache/CacheResult.cs b/src/Build/BackEnd/Components/ProjectCache/CacheResult.cs index fb23fdf63e8..30b1cca5a46 100644 --- a/src/Build/BackEnd/Components/ProjectCache/CacheResult.cs +++ b/src/Build/BackEnd/Components/ProjectCache/CacheResult.cs @@ -89,7 +89,7 @@ public static CacheResult IndicateCacheHit(ProxyTargets proxyTargets) public static CacheResult IndicateCacheHit(IReadOnlyCollection targetResults) { - ErrorUtilities.VerifyThrowArgumentLength(targetResults, nameof(targetResults)); + ErrorUtilities.VerifyThrowArgumentLength(targetResults); return new CacheResult(CacheResultType.CacheHit, ConstructBuildResult(targetResults)); } diff --git a/src/Build/BackEnd/Components/ProjectCache/ProxyTargets.cs b/src/Build/BackEnd/Components/ProjectCache/ProxyTargets.cs index 970dfdd3332..85e8f5a4c12 100644 --- a/src/Build/BackEnd/Components/ProjectCache/ProxyTargets.cs +++ b/src/Build/BackEnd/Components/ProjectCache/ProxyTargets.cs @@ -33,7 +33,7 @@ private ProxyTargets() public ProxyTargets(IReadOnlyDictionary proxyTargetToRealTargetMap) { - ErrorUtilities.VerifyThrowArgumentLength(proxyTargetToRealTargetMap, nameof(proxyTargetToRealTargetMap)); + ErrorUtilities.VerifyThrowArgumentLength(proxyTargetToRealTargetMap); _proxyTargetToRealTargetMap = proxyTargetToRealTargetMap.ToDictionary(kvp => kvp.Key, kvp => kvp.Value, StringComparer.OrdinalIgnoreCase); } diff --git a/src/Build/BackEnd/Components/RequestBuilder/TargetSpecification.cs b/src/Build/BackEnd/Components/RequestBuilder/TargetSpecification.cs index 041d5579421..38c2304ecc8 100644 --- a/src/Build/BackEnd/Components/RequestBuilder/TargetSpecification.cs +++ b/src/Build/BackEnd/Components/RequestBuilder/TargetSpecification.cs @@ -29,7 +29,7 @@ internal class TargetSpecification : ITranslatable /// Reason the target is being built internal TargetSpecification(string targetName, ElementLocation referenceLocation, TargetBuiltReason targetBuiltReason = TargetBuiltReason.None) { - ErrorUtilities.VerifyThrowArgumentLength(targetName, nameof(targetName)); + ErrorUtilities.VerifyThrowArgumentLength(targetName); ErrorUtilities.VerifyThrowArgumentNull(referenceLocation); this._targetName = targetName; diff --git a/src/Build/BackEnd/Shared/ConfigurationMetadata.cs b/src/Build/BackEnd/Shared/ConfigurationMetadata.cs index d5b8057016b..a08d818d4a6 100644 --- a/src/Build/BackEnd/Shared/ConfigurationMetadata.cs +++ b/src/Build/BackEnd/Shared/ConfigurationMetadata.cs @@ -51,7 +51,7 @@ public ConfigurationMetadata(Project project) /// public ConfigurationMetadata(string projectFullPath, PropertyDictionary globalProperties) { - ErrorUtilities.VerifyThrowArgumentLength(projectFullPath, nameof(projectFullPath)); + ErrorUtilities.VerifyThrowArgumentLength(projectFullPath); ErrorUtilities.VerifyThrowArgumentNull(globalProperties); _projectFullPath = projectFullPath; diff --git a/src/Build/Collections/CopyOnWritePropertyDictionary.cs b/src/Build/Collections/CopyOnWritePropertyDictionary.cs index 004f8e484e7..41dd414b5cf 100644 --- a/src/Build/Collections/CopyOnWritePropertyDictionary.cs +++ b/src/Build/Collections/CopyOnWritePropertyDictionary.cs @@ -324,7 +324,7 @@ IEnumerator> IEnumerable>.GetEnu /// public bool Remove(string name) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); return ImmutableInterlocked.TryRemove(ref _backing, name, out _); } diff --git a/src/Build/Collections/PropertyDictionary.cs b/src/Build/Collections/PropertyDictionary.cs index fc7dddd3c80..6e3602037a3 100644 --- a/src/Build/Collections/PropertyDictionary.cs +++ b/src/Build/Collections/PropertyDictionary.cs @@ -459,7 +459,7 @@ IEnumerator> IEnumerable>.GetEnu /// internal bool Remove(string name) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); lock (_properties) { diff --git a/src/Build/Construction/ProjectExtensionsElement.cs b/src/Build/Construction/ProjectExtensionsElement.cs index f2c5c738b70..ea7c5ef3c56 100644 --- a/src/Build/Construction/ProjectExtensionsElement.cs +++ b/src/Build/Construction/ProjectExtensionsElement.cs @@ -101,7 +101,7 @@ public string this[string name] { get { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); if (Link != null) { @@ -116,7 +116,7 @@ public string this[string name] set { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); ErrorUtilities.VerifyThrowArgumentNull(value, "value"); if (Link != null) diff --git a/src/Build/Construction/ProjectImportGroupElement.cs b/src/Build/Construction/ProjectImportGroupElement.cs index 0c3b3ac629a..adb72df7c75 100644 --- a/src/Build/Construction/ProjectImportGroupElement.cs +++ b/src/Build/Construction/ProjectImportGroupElement.cs @@ -61,7 +61,7 @@ private ProjectImportGroupElement(XmlElementWithLocation xmlElement, ProjectRoot /// public ProjectImportElement AddImport(string project) { - ErrorUtilities.VerifyThrowArgumentLength(project, nameof(project)); + ErrorUtilities.VerifyThrowArgumentLength(project); ProjectImportElement newImport = ContainingProject.CreateImportElement(project); AppendChild(newImport); diff --git a/src/Build/Construction/ProjectItemDefinitionElement.cs b/src/Build/Construction/ProjectItemDefinitionElement.cs index 277ad94c8df..4f9cb34d7d6 100644 --- a/src/Build/Construction/ProjectItemDefinitionElement.cs +++ b/src/Build/Construction/ProjectItemDefinitionElement.cs @@ -72,7 +72,7 @@ public ProjectMetadataElement AddMetadata(string name, string unevaluatedValue) /// public ProjectMetadataElement AddMetadata(string name, string unevaluatedValue, bool expressAsAttribute) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue); if (expressAsAttribute) diff --git a/src/Build/Construction/ProjectItemElement.cs b/src/Build/Construction/ProjectItemElement.cs index 367422480cc..f2c221f43f9 100644 --- a/src/Build/Construction/ProjectItemElement.cs +++ b/src/Build/Construction/ProjectItemElement.cs @@ -389,7 +389,7 @@ public ProjectMetadataElement AddMetadata(string name, string unevaluatedValue) /// public ProjectMetadataElement AddMetadata(string name, string unevaluatedValue, bool expressAsAttribute) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue); if (expressAsAttribute) @@ -439,7 +439,7 @@ internal static ProjectItemElement CreateDisconnected(string itemType, ProjectRo /// internal void ChangeItemType(string newItemType) { - ErrorUtilities.VerifyThrowArgumentLength(newItemType, nameof(newItemType)); + ErrorUtilities.VerifyThrowArgumentLength(newItemType); XmlUtilities.VerifyThrowArgumentValidElementName(newItemType); ErrorUtilities.VerifyThrowArgument(!XMakeElements.ReservedItemNames.Contains(newItemType), "CannotModifyReservedItem", newItemType); if (Link != null) diff --git a/src/Build/Construction/ProjectItemGroupElement.cs b/src/Build/Construction/ProjectItemGroupElement.cs index b5e796d9a60..a4ad7f1b894 100644 --- a/src/Build/Construction/ProjectItemGroupElement.cs +++ b/src/Build/Construction/ProjectItemGroupElement.cs @@ -99,8 +99,8 @@ public ProjectItemElement AddItem(string itemType, string include) /// public ProjectItemElement AddItem(string itemType, string include, IEnumerable> metadata) { - ErrorUtilities.VerifyThrowArgumentLength(itemType, nameof(itemType)); - ErrorUtilities.VerifyThrowArgumentLength(include, nameof(include)); + ErrorUtilities.VerifyThrowArgumentLength(itemType); + ErrorUtilities.VerifyThrowArgumentLength(include); // If there are no items, or it turns out that there are only items with // item types that sort earlier, then we should go after the last child diff --git a/src/Build/Construction/ProjectMetadataElement.cs b/src/Build/Construction/ProjectMetadataElement.cs index 7a7342366a5..156755286d1 100644 --- a/src/Build/Construction/ProjectMetadataElement.cs +++ b/src/Build/Construction/ProjectMetadataElement.cs @@ -119,7 +119,7 @@ internal static ProjectMetadataElement CreateDisconnected(string name, ProjectRo /// internal void ChangeName(string newName) { - ErrorUtilities.VerifyThrowArgumentLength(newName, nameof(newName)); + ErrorUtilities.VerifyThrowArgumentLength(newName); XmlUtilities.VerifyThrowArgumentValidElementName(newName); ErrorUtilities.VerifyThrowArgument(!XMakeElements.ReservedItemNames.Contains(newName), "CannotModifyReservedItemMetadata", newName); diff --git a/src/Build/Construction/ProjectOutputElement.cs b/src/Build/Construction/ProjectOutputElement.cs index b4669f2b9e0..928a9d64ce5 100644 --- a/src/Build/Construction/ProjectOutputElement.cs +++ b/src/Build/Construction/ProjectOutputElement.cs @@ -57,7 +57,7 @@ public string TaskParameter [DebuggerStepThrough] set { - ErrorUtilities.VerifyThrowArgumentLength(value, nameof(value)); + ErrorUtilities.VerifyThrowArgumentLength(value); SetOrRemoveAttribute(XMakeAttributes.taskParameter, value, "Set Output TaskParameter {0}", value); } } diff --git a/src/Build/Construction/ProjectPropertyElement.cs b/src/Build/Construction/ProjectPropertyElement.cs index 4d2970426ac..05ff4ce7291 100644 --- a/src/Build/Construction/ProjectPropertyElement.cs +++ b/src/Build/Construction/ProjectPropertyElement.cs @@ -109,7 +109,7 @@ internal static ProjectPropertyElement CreateDisconnected(string name, ProjectRo /// internal void ChangeName(string newName) { - ErrorUtilities.VerifyThrowArgumentLength(newName, nameof(newName)); + ErrorUtilities.VerifyThrowArgumentLength(newName); XmlUtilities.VerifyThrowArgumentValidElementName(newName); ErrorUtilities.VerifyThrowArgument(!XMakeElements.ReservedItemNames.Contains(newName), "CannotModifyReservedProperty", newName); if (Link != null) diff --git a/src/Build/Construction/ProjectPropertyGroupElement.cs b/src/Build/Construction/ProjectPropertyGroupElement.cs index 808da5e4204..54dc54c3e9d 100644 --- a/src/Build/Construction/ProjectPropertyGroupElement.cs +++ b/src/Build/Construction/ProjectPropertyGroupElement.cs @@ -58,7 +58,7 @@ private ProjectPropertyGroupElement(XmlElementWithLocation xmlElement, ProjectRo /// public ProjectPropertyElement AddProperty(string name, string unevaluatedValue) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue); ProjectPropertyElement newProperty = ContainingProject.CreatePropertyElement(name); @@ -75,7 +75,7 @@ public ProjectPropertyElement AddProperty(string name, string unevaluatedValue) /// public ProjectPropertyElement SetProperty(string name, string unevaluatedValue) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue); foreach (ProjectPropertyElement property in Properties) diff --git a/src/Build/Construction/ProjectRootElement.cs b/src/Build/Construction/ProjectRootElement.cs index bdeb2337389..cc416e5d409 100644 --- a/src/Build/Construction/ProjectRootElement.cs +++ b/src/Build/Construction/ProjectRootElement.cs @@ -214,7 +214,7 @@ private ProjectRootElement( ProjectRootElementCacheBase projectRootElementCache, bool preserveFormatting) { - ErrorUtilities.VerifyThrowArgumentLength(path, nameof(path)); + ErrorUtilities.VerifyThrowArgumentLength(path); ErrorUtilities.VerifyThrowInternalRooted(path); ErrorUtilities.VerifyThrowArgumentNull(projectRootElementCache); ProjectRootElementCache = projectRootElementCache; @@ -397,7 +397,7 @@ public string FullPath set { - ErrorUtilities.VerifyThrowArgumentLength(value, nameof(value)); + ErrorUtilities.VerifyThrowArgumentLength(value); if (Link != null) { RootLink.FullPath = value; @@ -782,7 +782,7 @@ public static ProjectRootElement Create(string path, ProjectCollection projectCo /// public static ProjectRootElement Create(string path, ProjectCollection projectCollection, NewProjectFileOptions newProjectFileOptions) { - ErrorUtilities.VerifyThrowArgumentLength(path, nameof(path)); + ErrorUtilities.VerifyThrowArgumentLength(path); ErrorUtilities.VerifyThrowArgumentNull(projectCollection); var projectRootElement = new ProjectRootElement( @@ -853,7 +853,7 @@ public static ProjectRootElement Open(string path, ProjectCollection projectColl /// public static ProjectRootElement Open(string path, ProjectCollection projectCollection, bool? preserveFormatting) { - ErrorUtilities.VerifyThrowArgumentLength(path, nameof(path)); + ErrorUtilities.VerifyThrowArgumentLength(path); ErrorUtilities.VerifyThrowArgumentNull(projectCollection); path = FileUtilities.NormalizePath(path); @@ -873,7 +873,7 @@ public static ProjectRootElement Open(string path, ProjectCollection projectColl /// public static ProjectRootElement TryOpen(string path) { - ErrorUtilities.VerifyThrowArgumentLength(path, nameof(path)); + ErrorUtilities.VerifyThrowArgumentLength(path); return TryOpen(path, ProjectCollection.GlobalProjectCollection); } @@ -910,7 +910,7 @@ public static ProjectRootElement TryOpen(string path, ProjectCollection projectC /// public static ProjectRootElement TryOpen(string path, ProjectCollection projectCollection, bool? preserveFormatting) { - ErrorUtilities.VerifyThrowArgumentLength(path, nameof(path)); + ErrorUtilities.VerifyThrowArgumentLength(path); ErrorUtilities.VerifyThrowArgumentNull(projectCollection); path = FileUtilities.NormalizePath(path); @@ -927,7 +927,7 @@ public static ProjectRootElement TryOpen(string path, ProjectCollection projectC /// public ProjectImportElement AddImport(string project) { - ErrorUtilities.VerifyThrowArgumentLength(project, nameof(project)); + ErrorUtilities.VerifyThrowArgumentLength(project); ProjectImportGroupElement importGroupToAddTo = ImportGroupsReversed.FirstOrDefault(importGroup => importGroup.Condition.Length <= 0); @@ -984,8 +984,8 @@ public ProjectItemElement AddItem(string itemType, string include) /// public ProjectItemElement AddItem(string itemType, string include, IEnumerable> metadata) { - ErrorUtilities.VerifyThrowArgumentLength(itemType, nameof(itemType)); - ErrorUtilities.VerifyThrowArgumentLength(include, nameof(include)); + ErrorUtilities.VerifyThrowArgumentLength(itemType); + ErrorUtilities.VerifyThrowArgumentLength(include); ProjectItemGroupElement itemGroupToAddTo = null; @@ -1061,7 +1061,7 @@ public ProjectItemGroupElement AddItemGroup() /// public ProjectItemDefinitionElement AddItemDefinition(string itemType) { - ErrorUtilities.VerifyThrowArgumentLength(itemType, nameof(itemType)); + ErrorUtilities.VerifyThrowArgumentLength(itemType); ProjectItemDefinitionGroupElement itemDefinitionGroupToAddTo = null; diff --git a/src/Build/Construction/ProjectTargetElement.cs b/src/Build/Construction/ProjectTargetElement.cs index 43c83669abf..db079f86773 100644 --- a/src/Build/Construction/ProjectTargetElement.cs +++ b/src/Build/Construction/ProjectTargetElement.cs @@ -97,7 +97,7 @@ public string Name set { - ErrorUtilities.VerifyThrowArgumentLength(value, nameof(value)); + ErrorUtilities.VerifyThrowArgumentLength(value); if (Link != null) { TargetLink.Name = value; @@ -378,7 +378,7 @@ public ProjectPropertyGroupElement AddPropertyGroup() /// public ProjectTaskElement AddTask(string taskName) { - ErrorUtilities.VerifyThrowArgumentLength(taskName, nameof(taskName)); + ErrorUtilities.VerifyThrowArgumentLength(taskName); ProjectTaskElement task = ContainingProject.CreateTaskElement(taskName); diff --git a/src/Build/Construction/ProjectTaskElement.cs b/src/Build/Construction/ProjectTaskElement.cs index cc0d2f02a99..b8d1b257425 100644 --- a/src/Build/Construction/ProjectTaskElement.cs +++ b/src/Build/Construction/ProjectTaskElement.cs @@ -229,8 +229,8 @@ public IEnumerable> ParameterLocations /// public ProjectOutputElement AddOutputItem(string taskParameter, string itemType) { - ErrorUtilities.VerifyThrowArgumentLength(taskParameter, nameof(taskParameter)); - ErrorUtilities.VerifyThrowArgumentLength(itemType, nameof(itemType)); + ErrorUtilities.VerifyThrowArgumentLength(taskParameter); + ErrorUtilities.VerifyThrowArgumentLength(itemType); return AddOutputItem(taskParameter, itemType, null); } @@ -259,8 +259,8 @@ public ProjectOutputElement AddOutputItem(string taskParameter, string itemType, /// public ProjectOutputElement AddOutputProperty(string taskParameter, string propertyName) { - ErrorUtilities.VerifyThrowArgumentLength(taskParameter, nameof(taskParameter)); - ErrorUtilities.VerifyThrowArgumentLength(propertyName, nameof(propertyName)); + ErrorUtilities.VerifyThrowArgumentLength(taskParameter); + ErrorUtilities.VerifyThrowArgumentLength(propertyName); return AddOutputProperty(taskParameter, propertyName, null); } @@ -296,7 +296,7 @@ public string GetParameter(string name) lock (_locker) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); EnsureParametersInitialized(); @@ -322,7 +322,7 @@ public void SetParameter(string name, string unevaluatedValue) lock (_locker) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue); ErrorUtilities.VerifyThrowArgument(!XMakeAttributes.IsSpecialTaskAttribute(name), "CannotAccessKnownAttributes", name); @@ -411,7 +411,7 @@ public override void CopyFrom(ProjectElement element) /// internal static ProjectTaskElement CreateDisconnected(string name, ProjectRootElement containingProject) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); XmlElementWithLocation element = containingProject.CreateElement(name); diff --git a/src/Build/Construction/Solution/ProjectInSolution.cs b/src/Build/Construction/Solution/ProjectInSolution.cs index a73df401565..5ff9a3ec8bc 100644 --- a/src/Build/Construction/Solution/ProjectInSolution.cs +++ b/src/Build/Construction/Solution/ProjectInSolution.cs @@ -477,7 +477,7 @@ internal string GetProjectGuidWithoutCurlyBrackets() /// internal void UpdateUniqueProjectName(string newUniqueName) { - ErrorUtilities.VerifyThrowArgumentLength(newUniqueName, nameof(newUniqueName)); + ErrorUtilities.VerifyThrowArgumentLength(newUniqueName); _uniqueProjectName = newUniqueName; } diff --git a/src/Build/Construction/UsingTaskParameterGroupElement.cs b/src/Build/Construction/UsingTaskParameterGroupElement.cs index f4d34c27909..b10431cda04 100644 --- a/src/Build/Construction/UsingTaskParameterGroupElement.cs +++ b/src/Build/Construction/UsingTaskParameterGroupElement.cs @@ -77,7 +77,7 @@ public override ElementLocation ConditionLocation /// public ProjectUsingTaskParameterElement AddParameter(string name, string output, string required, string parameterType) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); ProjectUsingTaskParameterElement newParameter = ContainingProject.CreateUsingTaskParameterElement(name, output, required, parameterType); AppendChild(newParameter); diff --git a/src/Build/Definition/Project.cs b/src/Build/Definition/Project.cs index 51934fa7504..a2f19926d69 100644 --- a/src/Build/Definition/Project.cs +++ b/src/Build/Definition/Project.cs @@ -2924,7 +2924,7 @@ public override string GetPropertyValue(string name) /// public override ProjectProperty SetProperty(string name, string unevaluatedValue) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue); ProjectProperty property = _data.Properties[name]; @@ -3052,8 +3052,8 @@ public override IList AddItem(string itemType, string unevaluatedIn /// public override IList AddItemFast(string itemType, string unevaluatedInclude, IEnumerable> metadata) { - ErrorUtilities.VerifyThrowArgumentLength(itemType, nameof(itemType)); - ErrorUtilities.VerifyThrowArgumentLength(unevaluatedInclude, nameof(unevaluatedInclude)); + ErrorUtilities.VerifyThrowArgumentLength(itemType); + ErrorUtilities.VerifyThrowArgumentLength(unevaluatedInclude); ProjectItemGroupElement groupToAppendTo = null; @@ -3179,7 +3179,7 @@ public override bool RemoveProperty(ProjectProperty property) /// public override bool RemoveGlobalProperty(string name) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); bool result = _data.GlobalPropertiesDictionary.Remove(name); @@ -4623,7 +4623,7 @@ internal ICollection GetItemsByEvaluatedInclude(string evaluatedInc /// internal string GetPropertyValue(string name) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); ProjectProperty property = Properties[name]; string value = property?.EvaluatedValue ?? String.Empty; diff --git a/src/Build/Definition/ProjectCollection.cs b/src/Build/Definition/ProjectCollection.cs index 306b8e22169..031e31f1e2e 100644 --- a/src/Build/Definition/ProjectCollection.cs +++ b/src/Build/Definition/ProjectCollection.cs @@ -1026,7 +1026,7 @@ public void AddToolset(Toolset toolset) /// public bool RemoveToolset(string toolsVersion) { - ErrorUtilities.VerifyThrowArgumentLength(toolsVersion, nameof(toolsVersion)); + ErrorUtilities.VerifyThrowArgumentLength(toolsVersion); bool changed; using (_locker.EnterDisposableWriteLock()) @@ -1070,7 +1070,7 @@ public void RemoveAllToolsets() /// public Toolset GetToolset(string toolsVersion) { - ErrorUtilities.VerifyThrowArgumentLength(toolsVersion, nameof(toolsVersion)); + ErrorUtilities.VerifyThrowArgumentLength(toolsVersion); using (_locker.EnterDisposableWriteLock()) { _toolsets.TryGetValue(toolsVersion, out var toolset); @@ -1157,7 +1157,7 @@ public Project LoadProject(string fileName, string toolsVersion) /// A loaded project. public Project LoadProject(string fileName, IDictionary globalProperties, string toolsVersion) { - ErrorUtilities.VerifyThrowArgumentLength(fileName, nameof(fileName)); + ErrorUtilities.VerifyThrowArgumentLength(fileName); fileName = FileUtilities.NormalizePath(fileName); using (_locker.EnterDisposableWriteLock()) diff --git a/src/Build/Definition/ProjectItem.cs b/src/Build/Definition/ProjectItem.cs index e203061b22a..d6af33d1f2a 100644 --- a/src/Build/Definition/ProjectItem.cs +++ b/src/Build/Definition/ProjectItem.cs @@ -407,7 +407,7 @@ public ProjectMetadata GetMetadata(string name) return Link.GetMetadata(name); } - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); ProjectMetadata result = null; @@ -473,7 +473,7 @@ public bool HasMetadata(string name) /// string IItem.GetMetadataValueEscaped(string name) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); string value = null; @@ -635,7 +635,7 @@ public bool RemoveMetadata(string name) return Link.RemoveMetadata(name); } - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); ErrorUtilities.VerifyThrowArgument(!FileUtilities.ItemSpecModifiers.IsItemSpecModifier(name), "ItemSpecModifierCannotBeCustomMetadata", name); Project.VerifyThrowInvalidOperationNotImported(_xml.ContainingProject); ErrorUtilities.VerifyThrowInvalidOperation(_xml.Parent?.Parent != null, "OM_ObjectIsNoLongerActive"); diff --git a/src/Build/Definition/ProjectItemDefinition.cs b/src/Build/Definition/ProjectItemDefinition.cs index 8aabe516dc8..6cb2037246a 100644 --- a/src/Build/Definition/ProjectItemDefinition.cs +++ b/src/Build/Definition/ProjectItemDefinition.cs @@ -56,7 +56,7 @@ public class ProjectItemDefinition : IKeyed, IMetadataTable, IItemDefinition internal SubToolset(string subToolsetVersion, PropertyDictionary properties) { - ErrorUtilities.VerifyThrowArgumentLength(subToolsetVersion, nameof(subToolsetVersion)); + ErrorUtilities.VerifyThrowArgumentLength(subToolsetVersion); _subToolsetVersion = subToolsetVersion; _properties = properties; diff --git a/src/Build/Definition/Toolset.cs b/src/Build/Definition/Toolset.cs index c65e2093e5e..fac22092ded 100644 --- a/src/Build/Definition/Toolset.cs +++ b/src/Build/Definition/Toolset.cs @@ -270,8 +270,8 @@ public Toolset(string toolsVersion, string toolsPath, IDictionaryToolsVersion to use as the default ToolsVersion for this version of MSBuild. internal Toolset(string toolsVersion, string toolsPath, PropertyDictionary environmentProperties, PropertyDictionary globalProperties, string msbuildOverrideTasksPath, string defaultOverrideToolsVersion) { - ErrorUtilities.VerifyThrowArgumentLength(toolsVersion, nameof(toolsVersion)); - ErrorUtilities.VerifyThrowArgumentLength(toolsPath, nameof(toolsPath)); + ErrorUtilities.VerifyThrowArgumentLength(toolsVersion); + ErrorUtilities.VerifyThrowArgumentLength(toolsPath); ErrorUtilities.VerifyThrowArgumentNull(environmentProperties); ErrorUtilities.VerifyThrowArgumentNull(globalProperties); diff --git a/src/Build/Definition/ToolsetPropertyDefinition.cs b/src/Build/Definition/ToolsetPropertyDefinition.cs index 79deb3cafc5..e923f7cff5e 100644 --- a/src/Build/Definition/ToolsetPropertyDefinition.cs +++ b/src/Build/Definition/ToolsetPropertyDefinition.cs @@ -38,7 +38,7 @@ internal class ToolsetPropertyDefinition /// The property source public ToolsetPropertyDefinition(string name, string value, IElementLocation source) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); ErrorUtilities.VerifyThrowArgumentNull(source); // value can be the empty string but not null diff --git a/src/Build/Definition/ToolsetRegistryReader.cs b/src/Build/Definition/ToolsetRegistryReader.cs index 19bd5141017..9b8468f6e6c 100644 --- a/src/Build/Definition/ToolsetRegistryReader.cs +++ b/src/Build/Definition/ToolsetRegistryReader.cs @@ -235,7 +235,7 @@ protected override IEnumerable GetSubToolsetVersions(string toolsVersion /// An enumeration of property definitions. protected override IEnumerable GetSubToolsetPropertyDefinitions(string toolsVersion, string subToolsetVersion) { - ErrorUtilities.VerifyThrowArgumentLength(subToolsetVersion, nameof(subToolsetVersion)); + ErrorUtilities.VerifyThrowArgumentLength(subToolsetVersion); RegistryKeyWrapper toolsVersionWrapper = null; RegistryKeyWrapper subToolsetWrapper = null; diff --git a/src/Build/Errors/InvalidProjectFileException.cs b/src/Build/Errors/InvalidProjectFileException.cs index 19417da3f55..98550caeba2 100644 --- a/src/Build/Errors/InvalidProjectFileException.cs +++ b/src/Build/Errors/InvalidProjectFileException.cs @@ -216,7 +216,7 @@ internal InvalidProjectFileException( Exception innerException) : base(message, innerException) { ErrorUtilities.VerifyThrowArgumentNull(projectFile); - ErrorUtilities.VerifyThrowArgumentLength(message, nameof(message)); + ErrorUtilities.VerifyThrowArgumentLength(message); // Try to helpfully provide a full path if possible, but do so robustly. // This exception might be because the path was invalid! diff --git a/src/Build/Evaluation/ConditionEvaluator.cs b/src/Build/Evaluation/ConditionEvaluator.cs index 9bedc7a4175..67455f8b4c4 100644 --- a/src/Build/Evaluation/ConditionEvaluator.cs +++ b/src/Build/Evaluation/ConditionEvaluator.cs @@ -228,7 +228,7 @@ internal static bool EvaluateConditionCollectingConditionedProperties( { ErrorUtilities.VerifyThrowArgumentNull(condition); ErrorUtilities.VerifyThrowArgumentNull(expander); - ErrorUtilities.VerifyThrowArgumentLength(evaluationDirectory, nameof(evaluationDirectory)); + ErrorUtilities.VerifyThrowArgumentLength(evaluationDirectory); // An empty condition is equivalent to a "true" condition. if (condition.Length == 0) diff --git a/src/Build/Evaluation/Evaluator.cs b/src/Build/Evaluation/Evaluator.cs index 15e408735a3..456af7d1137 100644 --- a/src/Build/Evaluation/Evaluator.cs +++ b/src/Build/Evaluation/Evaluator.cs @@ -362,7 +362,7 @@ internal static void Evaluate( /// internal static List CreateItemsFromInclude(string rootDirectory, ProjectItemElement itemElement, IItemFactory itemFactory, string unevaluatedIncludeEscaped, Expander expander, ILoggingService loggingService, string buildEventFileInfoFullPath, BuildEventContext buildEventContext) { - ErrorUtilities.VerifyThrowArgumentLength(unevaluatedIncludeEscaped, nameof(unevaluatedIncludeEscaped)); + ErrorUtilities.VerifyThrowArgumentLength(unevaluatedIncludeEscaped); List items = new List(); itemFactory.ItemElement = itemElement; diff --git a/src/Build/Evaluation/ProjectRootElementCache.cs b/src/Build/Evaluation/ProjectRootElementCache.cs index 74a6ff50453..e086298a380 100644 --- a/src/Build/Evaluation/ProjectRootElementCache.cs +++ b/src/Build/Evaluation/ProjectRootElementCache.cs @@ -395,7 +395,7 @@ internal override void RenameEntry(string oldFullPath, ProjectRootElement projec { lock (_locker) { - ErrorUtilities.VerifyThrowArgumentLength(oldFullPath, nameof(oldFullPath)); + ErrorUtilities.VerifyThrowArgumentLength(oldFullPath); RenameEntryInternal(oldFullPath, projectRootElement); } } diff --git a/src/Build/Evaluation/ToolsetProvider.cs b/src/Build/Evaluation/ToolsetProvider.cs index bf1b87243a5..2bb4484fcbc 100644 --- a/src/Build/Evaluation/ToolsetProvider.cs +++ b/src/Build/Evaluation/ToolsetProvider.cs @@ -66,7 +66,7 @@ private ToolsetProvider(ITranslator translator) /// public Toolset GetToolset(string toolsVersion) { - ErrorUtilities.VerifyThrowArgumentLength(toolsVersion, nameof(toolsVersion)); + ErrorUtilities.VerifyThrowArgumentLength(toolsVersion); _toolsets.TryGetValue(toolsVersion, out var toolset); return toolset; diff --git a/src/Build/Graph/ProjectGraphEntryPoint.cs b/src/Build/Graph/ProjectGraphEntryPoint.cs index 6b0f4713494..cb5ee4d3c30 100644 --- a/src/Build/Graph/ProjectGraphEntryPoint.cs +++ b/src/Build/Graph/ProjectGraphEntryPoint.cs @@ -29,7 +29,7 @@ public ProjectGraphEntryPoint(string projectFile) /// The global properties to use for this entry point. May be null. public ProjectGraphEntryPoint(string projectFile, IDictionary globalProperties) { - ErrorUtilities.VerifyThrowArgumentLength(projectFile, nameof(projectFile)); + ErrorUtilities.VerifyThrowArgumentLength(projectFile); ProjectFile = FileUtilities.NormalizePath(projectFile); GlobalProperties = globalProperties; diff --git a/src/Build/Instance/ProjectInstance.cs b/src/Build/Instance/ProjectInstance.cs index cd0b402749d..a58bfad95dc 100644 --- a/src/Build/Instance/ProjectInstance.cs +++ b/src/Build/Instance/ProjectInstance.cs @@ -294,7 +294,7 @@ internal ProjectInstance(string projectFile, IDictionary globalP private ProjectInstance(string projectFile, IDictionary globalProperties, string toolsVersion, string subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings? projectLoadSettings, EvaluationContext evaluationContext, IDirectoryCacheFactory directoryCacheFactory, bool interactive) { - ErrorUtilities.VerifyThrowArgumentLength(projectFile, nameof(projectFile)); + ErrorUtilities.VerifyThrowArgumentLength(projectFile); ErrorUtilities.VerifyThrowArgumentLengthIfNotNull(toolsVersion, nameof(toolsVersion)); // We do not control the current directory at this point, but assume that if we were @@ -612,7 +612,7 @@ internal ProjectInstance(ProjectRootElement xml, IDictionary glo /// internal ProjectInstance(string projectFile, IDictionary globalProperties, string toolsVersion, BuildParameters buildParameters, ILoggingService loggingService, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, int submissionId, ProjectLoadSettings? projectLoadSettings) { - ErrorUtilities.VerifyThrowArgumentLength(projectFile, nameof(projectFile)); + ErrorUtilities.VerifyThrowArgumentLength(projectFile); ErrorUtilities.VerifyThrowArgumentLengthIfNotNull(toolsVersion, nameof(toolsVersion)); ErrorUtilities.VerifyThrowArgumentNull(buildParameters); @@ -2537,7 +2537,7 @@ internal static ProjectInstance[] LoadSolutionForBuild( ISdkResolverService sdkResolverService, int submissionId) { - ErrorUtilities.VerifyThrowArgumentLength(projectFile, nameof(projectFile)); + ErrorUtilities.VerifyThrowArgumentLength(projectFile); ErrorUtilities.VerifyThrowArgumentNull(globalPropertiesInstances); ErrorUtilities.VerifyThrowArgumentLengthIfNotNull(toolsVersion, nameof(toolsVersion)); ErrorUtilities.VerifyThrowArgumentNull(buildParameters); diff --git a/src/Build/Instance/ProjectItemInstance.cs b/src/Build/Instance/ProjectItemInstance.cs index c713c86ac0c..1e8e8f7003d 100644 --- a/src/Build/Instance/ProjectItemInstance.cs +++ b/src/Build/Instance/ProjectItemInstance.cs @@ -828,8 +828,8 @@ internal TaskItem( bool immutable, string definingFileEscaped) // the actual project file (or import) that defines this item. { - ErrorUtilities.VerifyThrowArgumentLength(includeEscaped, nameof(includeEscaped)); - ErrorUtilities.VerifyThrowArgumentLength(includeBeforeWildcardExpansionEscaped, nameof(includeBeforeWildcardExpansionEscaped)); + ErrorUtilities.VerifyThrowArgumentLength(includeEscaped); + ErrorUtilities.VerifyThrowArgumentLength(includeBeforeWildcardExpansionEscaped); _includeEscaped = FileUtilities.FixFilePath(includeEscaped); _includeBeforeWildcardExpansionEscaped = FileUtilities.FixFilePath(includeBeforeWildcardExpansionEscaped); @@ -1312,7 +1312,7 @@ public string GetMetadataEscaped(string metadataName) { if (string.IsNullOrEmpty(metadataName)) { - ErrorUtilities.VerifyThrowArgumentLength(metadataName, nameof(metadataName)); + ErrorUtilities.VerifyThrowArgumentLength(metadataName); } if (_directMetadata != null) diff --git a/src/Build/Instance/ProjectMetadataInstance.cs b/src/Build/Instance/ProjectMetadataInstance.cs index 9726d2de0d2..ec764cbbbb3 100644 --- a/src/Build/Instance/ProjectMetadataInstance.cs +++ b/src/Build/Instance/ProjectMetadataInstance.cs @@ -61,7 +61,7 @@ internal ProjectMetadataInstance(string name, string escapedValue) /// internal ProjectMetadataInstance(string name, string escapedValue, bool allowItemSpecModifiers) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); if (allowItemSpecModifiers) { diff --git a/src/Build/Instance/ProjectTaskInstance.cs b/src/Build/Instance/ProjectTaskInstance.cs index 83713347247..5dda3b2474c 100644 --- a/src/Build/Instance/ProjectTaskInstance.cs +++ b/src/Build/Instance/ProjectTaskInstance.cs @@ -161,7 +161,7 @@ internal ProjectTaskInstance( ElementLocation msbuildRuntimeLocation, ElementLocation msbuildArchitectureLocation) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); ErrorUtilities.VerifyThrowArgumentNull(condition); ErrorUtilities.VerifyThrowArgumentNull(continueOnError); @@ -337,8 +337,8 @@ internal void SetParameter(string parameterName, string unevaluatedValue) /// The condition. internal void AddOutputItem(string taskOutputParameterName, string itemName, string condition) { - ErrorUtilities.VerifyThrowArgumentLength(taskOutputParameterName, nameof(taskOutputParameterName)); - ErrorUtilities.VerifyThrowArgumentLength(itemName, nameof(itemName)); + ErrorUtilities.VerifyThrowArgumentLength(taskOutputParameterName); + ErrorUtilities.VerifyThrowArgumentLength(itemName); _outputs.Add(new ProjectTaskOutputItemInstance(itemName, taskOutputParameterName, condition ?? String.Empty, ElementLocation.EmptyLocation, ElementLocation.EmptyLocation, ElementLocation.EmptyLocation, condition == null ? null : ElementLocation.EmptyLocation)); } @@ -350,8 +350,8 @@ internal void AddOutputItem(string taskOutputParameterName, string itemName, str /// The condition. internal void AddOutputProperty(string taskOutputParameterName, string propertyName, string condition) { - ErrorUtilities.VerifyThrowArgumentLength(taskOutputParameterName, nameof(taskOutputParameterName)); - ErrorUtilities.VerifyThrowArgumentLength(propertyName, nameof(propertyName)); + ErrorUtilities.VerifyThrowArgumentLength(taskOutputParameterName); + ErrorUtilities.VerifyThrowArgumentLength(propertyName); _outputs.Add(new ProjectTaskOutputPropertyInstance(propertyName, taskOutputParameterName, condition ?? String.Empty, ElementLocation.EmptyLocation, ElementLocation.EmptyLocation, ElementLocation.EmptyLocation, condition == null ? null : ElementLocation.EmptyLocation)); } diff --git a/src/Build/Instance/TaskFactories/AssemblyTaskFactory.cs b/src/Build/Instance/TaskFactories/AssemblyTaskFactory.cs index f277795e40e..cce6e64af60 100644 --- a/src/Build/Instance/TaskFactories/AssemblyTaskFactory.cs +++ b/src/Build/Instance/TaskFactories/AssemblyTaskFactory.cs @@ -269,7 +269,7 @@ internal LoadedType InitializeFactory( try { - ErrorUtilities.VerifyThrowArgumentLength(taskName, nameof(taskName)); + ErrorUtilities.VerifyThrowArgumentLength(taskName); _taskName = taskName; string assemblyName = loadInfo.AssemblyName ?? Path.GetFileName(loadInfo.AssemblyFile); diff --git a/src/Build/Instance/TaskFactoryWrapper.cs b/src/Build/Instance/TaskFactoryWrapper.cs index 0254323deee..d9bfe7d56b9 100644 --- a/src/Build/Instance/TaskFactoryWrapper.cs +++ b/src/Build/Instance/TaskFactoryWrapper.cs @@ -83,7 +83,7 @@ public PropertyData( internal TaskFactoryWrapper(ITaskFactory taskFactory, LoadedType taskFactoryLoadInfo, string taskName, IDictionary factoryIdentityParameters) { ErrorUtilities.VerifyThrowArgumentNull(taskFactory); - ErrorUtilities.VerifyThrowArgumentLength(taskName, nameof(taskName)); + ErrorUtilities.VerifyThrowArgumentLength(taskName); _taskFactory = taskFactory; _taskName = taskName; TaskFactoryLoadedType = taskFactoryLoadInfo; diff --git a/src/Build/Utilities/RegistryKeyWrapper.cs b/src/Build/Utilities/RegistryKeyWrapper.cs index 2ceedb272c2..ac4ecb68421 100644 --- a/src/Build/Utilities/RegistryKeyWrapper.cs +++ b/src/Build/Utilities/RegistryKeyWrapper.cs @@ -160,7 +160,7 @@ public virtual string[] GetSubKeyNames() /// public virtual RegistryKeyWrapper OpenSubKey(string name) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); RegistryKeyWrapper wrapper = this; string[] keyNames = name.Split(MSBuildConstants.BackslashChar, StringSplitOptions.RemoveEmptyEntries); diff --git a/src/MSBuild/XMake.cs b/src/MSBuild/XMake.cs index d850697a06f..3031eb62eb1 100644 --- a/src/MSBuild/XMake.cs +++ b/src/MSBuild/XMake.cs @@ -663,7 +663,7 @@ public static ExitType Execute( Environment.SetEnvironmentVariable("MSBuildLoadMicrosoftTargetsReadOnly", "true"); #if FEATURE_GET_COMMANDLINE - ErrorUtilities.VerifyThrowArgumentLength(commandLine, nameof(commandLine)); + ErrorUtilities.VerifyThrowArgumentLength(commandLine); #endif AppDomain.CurrentDomain.UnhandledException += ExceptionHandling.UnhandledExceptionHandler; diff --git a/src/Shared/FileUtilities.cs b/src/Shared/FileUtilities.cs index 283908712a4..d6579dc0ada 100644 --- a/src/Shared/FileUtilities.cs +++ b/src/Shared/FileUtilities.cs @@ -461,7 +461,7 @@ private static bool IsValidRelativePathBound(char? c) /// internal static string NormalizePath(string path) { - ErrorUtilities.VerifyThrowArgumentLength(path, nameof(path)); + ErrorUtilities.VerifyThrowArgumentLength(path); string fullPath = GetFullPath(path); return FixFilePath(fullPath); } @@ -1126,7 +1126,7 @@ private static bool HasExtension(string filename, string extension) internal static string MakeRelative(string basePath, string path) { ErrorUtilities.VerifyThrowArgumentNull(basePath); - ErrorUtilities.VerifyThrowArgumentLength(path, nameof(path)); + ErrorUtilities.VerifyThrowArgumentLength(path); string fullBase = Path.GetFullPath(basePath); string fullPath = Path.GetFullPath(path); diff --git a/src/Shared/StringExtensions.cs b/src/Shared/StringExtensions.cs index ecdc3c21870..7f7c41f8ebc 100644 --- a/src/Shared/StringExtensions.cs +++ b/src/Shared/StringExtensions.cs @@ -17,7 +17,7 @@ public static string Replace(this string aString, string oldValue, string newVal { ErrorUtilities.VerifyThrowArgumentNull(aString); ErrorUtilities.VerifyThrowArgumentNull(oldValue); - ErrorUtilities.VerifyThrowArgumentLength(oldValue, nameof(oldValue)); + ErrorUtilities.VerifyThrowArgumentLength(oldValue); if (newValue == null) { diff --git a/src/Shared/TaskLoggingHelper.cs b/src/Shared/TaskLoggingHelper.cs index 17c26a6b81b..ebdfc1c2f2b 100644 --- a/src/Shared/TaskLoggingHelper.cs +++ b/src/Shared/TaskLoggingHelper.cs @@ -59,7 +59,7 @@ public TaskLoggingHelper(ITask taskInstance) public TaskLoggingHelper(IBuildEngine buildEngine, string taskName) { ErrorUtilities.VerifyThrowArgumentNull(buildEngine); - ErrorUtilities.VerifyThrowArgumentLength(taskName, nameof(taskName)); + ErrorUtilities.VerifyThrowArgumentLength(taskName); TaskName = taskName; _buildEngine = buildEngine; } diff --git a/src/Shared/TaskParameter.cs b/src/Shared/TaskParameter.cs index 6e237e30fba..9ce6fe2cdba 100644 --- a/src/Shared/TaskParameter.cs +++ b/src/Shared/TaskParameter.cs @@ -845,7 +845,7 @@ public string GetMetadata(string metadataName) /// The metadata value. public void SetMetadata(string metadataName, string metadataValue) { - ErrorUtilities.VerifyThrowArgumentLength(metadataName, nameof(metadataName)); + ErrorUtilities.VerifyThrowArgumentLength(metadataName); // Non-derivable metadata can only be set at construction time. // That's why this is IsItemSpecModifier and not IsDerivableItemSpecModifier. diff --git a/src/Shared/XmlUtilities.cs b/src/Shared/XmlUtilities.cs index 35a48f18c71..394e3eae1de 100644 --- a/src/Shared/XmlUtilities.cs +++ b/src/Shared/XmlUtilities.cs @@ -69,7 +69,7 @@ internal static XmlElementWithLocation RenameXmlElement(XmlElementWithLocation o /// name to validate internal static void VerifyThrowArgumentValidElementName(string name) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); int firstInvalidCharLocation = LocateFirstInvalidElementNameCharacter(name); @@ -88,7 +88,7 @@ internal static void VerifyThrowArgumentValidElementName(string name) /// internal static void VerifyThrowProjectValidElementName(string name, IElementLocation location) { - ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentLength(name); int firstInvalidCharLocation = LocateFirstInvalidElementNameCharacter(name); if (-1 != firstInvalidCharLocation) diff --git a/src/Tasks/FileState.cs b/src/Tasks/FileState.cs index 17cb7ca702c..9021a946833 100644 --- a/src/Tasks/FileState.cs +++ b/src/Tasks/FileState.cs @@ -247,7 +247,7 @@ public void ThrowException() /// internal FileState(string filename) { - ErrorUtilities.VerifyThrowArgumentLength(filename, nameof(filename)); + ErrorUtilities.VerifyThrowArgumentLength(filename); _filename = filename; _data = new Lazy(() => new FileDirInfo(_filename)); } diff --git a/src/Tasks/ResolveSDKReference.cs b/src/Tasks/ResolveSDKReference.cs index 9a717419223..4cf06aa29e8 100644 --- a/src/Tasks/ResolveSDKReference.cs +++ b/src/Tasks/ResolveSDKReference.cs @@ -727,8 +727,8 @@ internal class SDKReference : IEquatable public SDKReference(ITaskItem taskItem, string sdkName, string sdkVersion) { ErrorUtilities.VerifyThrowArgumentNull(taskItem); - ErrorUtilities.VerifyThrowArgumentLength(sdkName, nameof(sdkName)); - ErrorUtilities.VerifyThrowArgumentLength(sdkVersion, nameof(sdkVersion)); + ErrorUtilities.VerifyThrowArgumentLength(sdkName); + ErrorUtilities.VerifyThrowArgumentLength(sdkVersion); ReferenceItem = taskItem; SimpleName = sdkName; diff --git a/src/Tasks/XamlTaskFactory/TaskParser.cs b/src/Tasks/XamlTaskFactory/TaskParser.cs index 1a50acf29c8..ff723700f11 100644 --- a/src/Tasks/XamlTaskFactory/TaskParser.cs +++ b/src/Tasks/XamlTaskFactory/TaskParser.cs @@ -89,8 +89,8 @@ internal class TaskParser /// public bool Parse(string contentOrFile, string desiredRule) { - ErrorUtilities.VerifyThrowArgumentLength(contentOrFile, nameof(contentOrFile)); - ErrorUtilities.VerifyThrowArgumentLength(desiredRule, nameof(desiredRule)); + ErrorUtilities.VerifyThrowArgumentLength(contentOrFile); + ErrorUtilities.VerifyThrowArgumentLength(desiredRule); bool parseSuccessful = ParseAsContentOrFile(contentOrFile, desiredRule); if (!parseSuccessful) @@ -187,7 +187,7 @@ private bool ParseAsContentOrFile(string contentOrFile, string desiredRule) internal bool ParseXamlDocument(TextReader reader, string desiredRule) { ErrorUtilities.VerifyThrowArgumentNull(reader); - ErrorUtilities.VerifyThrowArgumentLength(desiredRule, nameof(desiredRule)); + ErrorUtilities.VerifyThrowArgumentLength(desiredRule); object rootObject = XamlServices.Load(reader); if (rootObject != null) diff --git a/src/Utilities/PlatformManifest.cs b/src/Utilities/PlatformManifest.cs index 653fc4c18d8..fec3fedbfca 100644 --- a/src/Utilities/PlatformManifest.cs +++ b/src/Utilities/PlatformManifest.cs @@ -28,7 +28,7 @@ internal class PlatformManifest /// public PlatformManifest(string pathToManifest) { - ErrorUtilities.VerifyThrowArgumentLength(pathToManifest, nameof(pathToManifest)); + ErrorUtilities.VerifyThrowArgumentLength(pathToManifest); _pathToManifest = pathToManifest; LoadManifestFile(); } diff --git a/src/Utilities/SDKManifest.cs b/src/Utilities/SDKManifest.cs index d5a4322a928..86e0be400ce 100644 --- a/src/Utilities/SDKManifest.cs +++ b/src/Utilities/SDKManifest.cs @@ -108,7 +108,7 @@ public class SDKManifest /// public SDKManifest(string pathToSdk) { - ErrorUtilities.VerifyThrowArgumentLength(pathToSdk, nameof(pathToSdk)); + ErrorUtilities.VerifyThrowArgumentLength(pathToSdk); _pathToSdk = pathToSdk; LoadManifestFile(); } diff --git a/src/Utilities/TaskItem.cs b/src/Utilities/TaskItem.cs index d05f69f98cc..e5e53b3ff01 100644 --- a/src/Utilities/TaskItem.cs +++ b/src/Utilities/TaskItem.cs @@ -262,7 +262,7 @@ public void SetMetadata( string metadataName, string metadataValue) { - ErrorUtilities.VerifyThrowArgumentLength(metadataName, nameof(metadataName)); + ErrorUtilities.VerifyThrowArgumentLength(metadataName); // Non-derivable metadata can only be set at construction time. // That's why this is IsItemSpecModifier and not IsDerivableItemSpecModifier. diff --git a/src/Utilities/ToolLocationHelper.cs b/src/Utilities/ToolLocationHelper.cs index 173301c4490..76198ed413a 100644 --- a/src/Utilities/ToolLocationHelper.cs +++ b/src/Utilities/ToolLocationHelper.cs @@ -322,9 +322,9 @@ public static class ToolLocationHelper [SupportedOSPlatform("windows")] public static IList GetAssemblyFoldersExInfo(string registryRoot, string targetFrameworkVersion, string registryKeySuffix, string osVersion, string platform, System.Reflection.ProcessorArchitecture targetProcessorArchitecture) { - ErrorUtilities.VerifyThrowArgumentLength(registryRoot, nameof(registryRoot)); - ErrorUtilities.VerifyThrowArgumentLength(registryKeySuffix, nameof(registryKeySuffix)); - ErrorUtilities.VerifyThrowArgumentLength(targetFrameworkVersion, nameof(targetFrameworkVersion)); + ErrorUtilities.VerifyThrowArgumentLength(registryRoot); + ErrorUtilities.VerifyThrowArgumentLength(registryKeySuffix); + ErrorUtilities.VerifyThrowArgumentLength(targetFrameworkVersion); AssemblyFoldersEx assemblyFoldersEx = new AssemblyFoldersEx(registryRoot, targetFrameworkVersion, registryKeySuffix, osVersion, platform, new GetRegistrySubKeyNames(RegistryHelper.GetSubKeyNames), new GetRegistrySubKeyDefaultValue(RegistryHelper.GetDefaultValue), targetProcessorArchitecture, new OpenBaseKey(RegistryHelper.OpenBaseKey)); @@ -354,8 +354,8 @@ public static IList GetAssemblyFoldersExInfo(string regis /// List of AssemblyFoldersFromConfigInfo public static IList GetAssemblyFoldersFromConfigInfo(string configFile, string targetFrameworkVersion, System.Reflection.ProcessorArchitecture targetProcessorArchitecture) { - ErrorUtilities.VerifyThrowArgumentLength(configFile, nameof(configFile)); - ErrorUtilities.VerifyThrowArgumentLength(targetFrameworkVersion, nameof(targetFrameworkVersion)); + ErrorUtilities.VerifyThrowArgumentLength(configFile); + ErrorUtilities.VerifyThrowArgumentLength(targetFrameworkVersion); var assemblyFoldersInfos = new AssemblyFoldersFromConfig(configFile, targetFrameworkVersion, targetProcessorArchitecture); @@ -460,7 +460,7 @@ public static IDictionary> GetPlatformExtensionSDK /// private static IEnumerable GetTargetPlatformMonikers(string[] diskRoots, string[] extensionDiskRoots, string registryRoot, string targetPlatformIdentifier, Version targetPlatformVersion) { - ErrorUtilities.VerifyThrowArgumentLength(targetPlatformIdentifier, nameof(targetPlatformIdentifier)); + ErrorUtilities.VerifyThrowArgumentLength(targetPlatformIdentifier); ErrorUtilities.VerifyThrowArgumentNull(targetPlatformVersion); string targetPlatformVersionString = targetPlatformVersion.ToString(); @@ -518,9 +518,9 @@ public static string GetPlatformExtensionSDKLocation(string sdkMoniker, string t [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "SDK", Justification = "Shipped this way in Dev11 Beta (go-live)")] public static string GetPlatformExtensionSDKLocation(string sdkMoniker, string targetPlatformIdentifier, Version targetPlatformVersion, string[] diskRoots, string[] extensionDiskRoots, string registryRoot) { - ErrorUtilities.VerifyThrowArgumentLength(targetPlatformIdentifier, nameof(targetPlatformIdentifier)); + ErrorUtilities.VerifyThrowArgumentLength(targetPlatformIdentifier); ErrorUtilities.VerifyThrowArgumentNull(targetPlatformVersion); - ErrorUtilities.VerifyThrowArgumentLength(sdkMoniker, nameof(sdkMoniker)); + ErrorUtilities.VerifyThrowArgumentLength(sdkMoniker); IEnumerable targetPlatforms = RetrieveTargetPlatformList(diskRoots, extensionDiskRoots, registryRoot); var targetPlatformMoniker = targetPlatforms.Where( @@ -650,9 +650,9 @@ public static IDictionary FilterPlatformExtensionSDKs(Version ta [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "SDK", Justification = "Shipped this way in Dev11 Beta (go-live)")] public static IList GetSDKReferenceFolders(string sdkRoot, string targetConfiguration, string targetArchitecture) { - ErrorUtilities.VerifyThrowArgumentLength(sdkRoot, nameof(sdkRoot)); - ErrorUtilities.VerifyThrowArgumentLength(targetConfiguration, nameof(targetConfiguration)); - ErrorUtilities.VerifyThrowArgumentLength(targetArchitecture, nameof(targetArchitecture)); + ErrorUtilities.VerifyThrowArgumentLength(sdkRoot); + ErrorUtilities.VerifyThrowArgumentLength(targetConfiguration); + ErrorUtilities.VerifyThrowArgumentLength(targetArchitecture); var referenceDirectories = new List(4); @@ -714,9 +714,9 @@ private static void AddSDKPaths(string sdkRoot, string folderName, string target [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "SDK", Justification = "Shipped this way in Dev11 Beta (go-live)")] public static IList GetSDKRedistFolders(string sdkRoot, string targetConfiguration, string targetArchitecture) { - ErrorUtilities.VerifyThrowArgumentLength(sdkRoot, nameof(sdkRoot)); - ErrorUtilities.VerifyThrowArgumentLength(targetConfiguration, nameof(targetConfiguration)); - ErrorUtilities.VerifyThrowArgumentLength(targetArchitecture, nameof(targetArchitecture)); + ErrorUtilities.VerifyThrowArgumentLength(sdkRoot); + ErrorUtilities.VerifyThrowArgumentLength(targetConfiguration); + ErrorUtilities.VerifyThrowArgumentLength(targetArchitecture); var redistDirectories = new List(4); @@ -744,9 +744,9 @@ public static IList GetSDKRedistFolders(string sdkRoot, string targetCon [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "SDK", Justification = "Shipped this way in Dev11 Beta (go-live)")] public static IList GetSDKDesignTimeFolders(string sdkRoot, string targetConfiguration, string targetArchitecture) { - ErrorUtilities.VerifyThrowArgumentLength(sdkRoot, nameof(sdkRoot)); - ErrorUtilities.VerifyThrowArgumentLength(targetConfiguration, nameof(targetConfiguration)); - ErrorUtilities.VerifyThrowArgumentLength(targetArchitecture, nameof(targetArchitecture)); + ErrorUtilities.VerifyThrowArgumentLength(sdkRoot); + ErrorUtilities.VerifyThrowArgumentLength(targetConfiguration); + ErrorUtilities.VerifyThrowArgumentLength(targetArchitecture); var designTimeDirectories = new List(4); @@ -821,8 +821,8 @@ public static string GetPlatformSDKPropsFileLocation(string sdkIdentifier, strin /// Location of the target platform SDK props file without .props filename public static string GetPlatformSDKPropsFileLocation(string sdkIdentifier, string sdkVersion, string targetPlatformIdentifier, string targetPlatformMinVersion, string targetPlatformVersion, string diskRoots, string registryRoot) { - ErrorUtilities.VerifyThrowArgumentLength(targetPlatformIdentifier, nameof(targetPlatformIdentifier)); - ErrorUtilities.VerifyThrowArgumentLength(targetPlatformVersion, nameof(targetPlatformVersion)); + ErrorUtilities.VerifyThrowArgumentLength(targetPlatformIdentifier); + ErrorUtilities.VerifyThrowArgumentLength(targetPlatformVersion); string propsFileLocation; try @@ -1020,8 +1020,8 @@ private static string GetPlatformVersion(TargetPlatformSDK targetSdk, string tar /// private static string[] GetLegacyTargetPlatformReferences(string targetPlatformIdentifier, string targetPlatformVersion, string diskRoots, string registryRoot) { - ErrorUtilities.VerifyThrowArgumentLength(targetPlatformIdentifier, nameof(targetPlatformIdentifier)); - ErrorUtilities.VerifyThrowArgumentLength(targetPlatformVersion, nameof(targetPlatformVersion)); + ErrorUtilities.VerifyThrowArgumentLength(targetPlatformIdentifier); + ErrorUtilities.VerifyThrowArgumentLength(targetPlatformVersion); try { @@ -1076,10 +1076,10 @@ private static string[] GetTargetPlatformReferencesFromManifest( string diskRoots, string registryRoot) { - ErrorUtilities.VerifyThrowArgumentLength(sdkIdentifier, nameof(sdkIdentifier)); - ErrorUtilities.VerifyThrowArgumentLength(sdkVersion, nameof(sdkVersion)); - ErrorUtilities.VerifyThrowArgumentLength(targetPlatformIdentifier, nameof(targetPlatformIdentifier)); - ErrorUtilities.VerifyThrowArgumentLength(targetPlatformVersion, nameof(targetPlatformVersion)); + ErrorUtilities.VerifyThrowArgumentLength(sdkIdentifier); + ErrorUtilities.VerifyThrowArgumentLength(sdkVersion); + ErrorUtilities.VerifyThrowArgumentLength(targetPlatformIdentifier); + ErrorUtilities.VerifyThrowArgumentLength(targetPlatformVersion); string[] contractWinMDs = []; @@ -1203,8 +1203,8 @@ public static string GetSDKContentFolderPath( string folderName, string diskRoot = null) { - ErrorUtilities.VerifyThrowArgumentLength(sdkIdentifier, nameof(sdkIdentifier)); - ErrorUtilities.VerifyThrowArgumentLength(sdkVersion, nameof(sdkVersion)); + ErrorUtilities.VerifyThrowArgumentLength(sdkIdentifier); + ErrorUtilities.VerifyThrowArgumentLength(sdkVersion); // Avoid exception in Path.Combine if (folderName == null) @@ -1219,8 +1219,8 @@ public static string GetSDKContentFolderPath( return Path.Combine(sdkLocation, folderName); } - ErrorUtilities.VerifyThrowArgumentLength(targetPlatformIdentifier, nameof(targetPlatformIdentifier)); - ErrorUtilities.VerifyThrowArgumentLength(targetPlatformVersion, nameof(targetPlatformVersion)); + ErrorUtilities.VerifyThrowArgumentLength(targetPlatformIdentifier); + ErrorUtilities.VerifyThrowArgumentLength(targetPlatformVersion); string sdkContentFolderPath = null; @@ -1582,7 +1582,7 @@ private static TargetPlatformSDK GetMatchingPlatformSDK(string targetPlatformIde /// private static TargetPlatformSDK GetMatchingPlatformSDK(string targetPlatformIdentifier, Version targetPlatformVersion, string[] diskRoots, string[] multiPlatformDiskRoots, string registryRoot) { - ErrorUtilities.VerifyThrowArgumentLength(targetPlatformIdentifier, nameof(targetPlatformIdentifier)); + ErrorUtilities.VerifyThrowArgumentLength(targetPlatformIdentifier); ErrorUtilities.VerifyThrowArgumentNull(targetPlatformVersion); IEnumerable targetPlatforms = RetrieveTargetPlatformList(diskRoots, multiPlatformDiskRoots, registryRoot); @@ -1808,8 +1808,8 @@ public static string GetPathToStandardLibraries(string targetFrameworkIdentifier /// Collection of reference assembly locations. public static string GetPathToStandardLibraries(string targetFrameworkIdentifier, string targetFrameworkVersion, string targetFrameworkProfile, string platformTarget, string targetFrameworkRootPath, string targetFrameworkFallbackSearchPaths) { - ErrorUtilities.VerifyThrowArgumentLength(targetFrameworkIdentifier, nameof(targetFrameworkIdentifier)); - ErrorUtilities.VerifyThrowArgumentLength(targetFrameworkVersion, nameof(targetFrameworkVersion)); + ErrorUtilities.VerifyThrowArgumentLength(targetFrameworkIdentifier); + ErrorUtilities.VerifyThrowArgumentLength(targetFrameworkVersion); Version frameworkVersion = ConvertTargetFrameworkVersionToVersion(targetFrameworkVersion); // For .net framework less than 4 the mscorlib should be found in the .net 2.0 directory @@ -1911,8 +1911,8 @@ public static IList GetPathToReferenceAssemblies(string targetFrameworkI /// Collection of reference assembly locations. public static IList GetPathToReferenceAssemblies(string targetFrameworkIdentifier, string targetFrameworkVersion, string targetFrameworkProfile, string targetFrameworkRootPath, string targetFrameworkFallbackSearchPaths) { - ErrorUtilities.VerifyThrowArgumentLength(targetFrameworkVersion, nameof(targetFrameworkVersion)); - ErrorUtilities.VerifyThrowArgumentLength(targetFrameworkIdentifier, nameof(targetFrameworkIdentifier)); + ErrorUtilities.VerifyThrowArgumentLength(targetFrameworkVersion); + ErrorUtilities.VerifyThrowArgumentLength(targetFrameworkIdentifier); ErrorUtilities.VerifyThrowArgumentNull(targetFrameworkProfile); Version frameworkVersion = ConvertTargetFrameworkVersionToVersion(targetFrameworkVersion); @@ -2211,7 +2211,7 @@ public static IList GetPathToReferenceAssemblies(string targetFrameworkR public static IList GetPathToReferenceAssemblies(string targetFrameworkRootPath, FrameworkNameVersioning frameworkName) { // Verify the root path is not null throw an ArgumentNullException if the given string parameter is null and ArgumentException if it has zero length. - ErrorUtilities.VerifyThrowArgumentLength(targetFrameworkRootPath, nameof(targetFrameworkRootPath)); + ErrorUtilities.VerifyThrowArgumentLength(targetFrameworkRootPath); // Verify the framework class passed in is not null. Other than being null the class will ensure it is consistent and the internal state is correct ErrorUtilities.VerifyThrowArgumentNull(frameworkName); @@ -3660,8 +3660,8 @@ public static IList GetSupportedTargetFrameworks() /// public static FrameworkNameVersioning HighestVersionOfTargetFrameworkIdentifier(string targetFrameworkRootDirectory, string frameworkIdentifier) { - ErrorUtilities.VerifyThrowArgumentLength(targetFrameworkRootDirectory, nameof(targetFrameworkRootDirectory)); - ErrorUtilities.VerifyThrowArgumentLength(frameworkIdentifier, nameof(frameworkIdentifier)); + ErrorUtilities.VerifyThrowArgumentLength(targetFrameworkRootDirectory); + ErrorUtilities.VerifyThrowArgumentLength(frameworkIdentifier); string key = targetFrameworkRootDirectory + ";" + frameworkIdentifier; FrameworkNameVersioning highestFrameworkName = null;