diff --git a/src/Build/BackEnd/BuildManager/BuildManager.cs b/src/Build/BackEnd/BuildManager/BuildManager.cs index 3d8ccf424f..c095e622ec 100644 --- a/src/Build/BackEnd/BuildManager/BuildManager.cs +++ b/src/Build/BackEnd/BuildManager/BuildManager.cs @@ -287,7 +287,7 @@ namespace Microsoft.Build.Execution /// public BuildManager(string hostName) { - ErrorUtilities.VerifyThrowArgumentNull(hostName, nameof(hostName)); + ErrorUtilities.VerifyThrowArgumentNull(hostName); _hostName = hostName; _buildManagerState = BuildManagerState.Idle; _buildSubmissions = new Dictionary(); @@ -888,7 +888,7 @@ namespace Microsoft.Build.Execution { lock (_syncLock) { - ErrorUtilities.VerifyThrowArgumentNull(requestData, nameof(requestData)); + ErrorUtilities.VerifyThrowArgumentNull(requestData); ErrorIfState(BuildManagerState.WaitingForBuildToComplete, "WaitingForEndOfBuild"); ErrorIfState(BuildManagerState.Idle, "NoBuildInProgress"); VerifyStateInternal(BuildManagerState.Building); @@ -1230,7 +1230,7 @@ namespace Microsoft.Build.Execution [SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "Complex class might need refactoring to separate scheduling elements from submission elements.")] private void ExecuteSubmission(BuildSubmission submission, bool allowMainThreadBuild) { - ErrorUtilities.VerifyThrowArgumentNull(submission, nameof(submission)); + ErrorUtilities.VerifyThrowArgumentNull(submission); ErrorUtilities.VerifyThrow(!submission.IsCompleted, "Submission already complete."); BuildRequestConfiguration? resolvedConfiguration = null; diff --git a/src/Build/BackEnd/BuildManager/BuildParameters.cs b/src/Build/BackEnd/BuildManager/BuildParameters.cs index 0ce7139728..bb3e942b7f 100644 --- a/src/Build/BackEnd/BuildManager/BuildParameters.cs +++ b/src/Build/BackEnd/BuildManager/BuildParameters.cs @@ -240,7 +240,7 @@ namespace Microsoft.Build.Execution /// The ProjectCollection from which the BuildParameters should populate itself. public BuildParameters(ProjectCollection projectCollection) { - ErrorUtilities.VerifyThrowArgumentNull(projectCollection, nameof(projectCollection)); + ErrorUtilities.VerifyThrowArgumentNull(projectCollection); Initialize(new PropertyDictionary(projectCollection.EnvironmentProperties), projectCollection.ProjectRootElementCache, new ToolsetProvider(projectCollection.Toolsets)); diff --git a/src/Build/BackEnd/BuildManager/BuildRequestData.cs b/src/Build/BackEnd/BuildManager/BuildRequestData.cs index 5c69b4aebd..a49b1aebd3 100644 --- a/src/Build/BackEnd/BuildManager/BuildRequestData.cs +++ b/src/Build/BackEnd/BuildManager/BuildRequestData.cs @@ -64,7 +64,7 @@ namespace Microsoft.Build.Execution public BuildRequestData(ProjectInstance projectInstance, string[] targetsToBuild, HostServices? hostServices, BuildRequestDataFlags flags, IEnumerable? propertiesToTransfer) : this(targetsToBuild, hostServices, flags, projectInstance.FullPath) { - ErrorUtilities.VerifyThrowArgumentNull(projectInstance, nameof(projectInstance)); + ErrorUtilities.VerifyThrowArgumentNull(projectInstance); foreach (string targetName in targetsToBuild) { @@ -93,7 +93,7 @@ namespace Microsoft.Build.Execution public BuildRequestData(ProjectInstance projectInstance, string[] targetsToBuild, HostServices? hostServices, BuildRequestDataFlags flags, IEnumerable? propertiesToTransfer, RequestedProjectState requestedProjectState) : this(projectInstance, targetsToBuild, hostServices, flags, propertiesToTransfer) { - ErrorUtilities.VerifyThrowArgumentNull(requestedProjectState, nameof(requestedProjectState)); + ErrorUtilities.VerifyThrowArgumentNull(requestedProjectState); RequestedProjectState = requestedProjectState; } @@ -127,7 +127,7 @@ namespace Microsoft.Build.Execution RequestedProjectState requestedProjectState) : this(projectFullPath, globalProperties, toolsVersion, targetsToBuild, hostServices, flags) { - ErrorUtilities.VerifyThrowArgumentNull(requestedProjectState, nameof(requestedProjectState)); + ErrorUtilities.VerifyThrowArgumentNull(requestedProjectState); RequestedProjectState = requestedProjectState; } @@ -145,7 +145,7 @@ namespace Microsoft.Build.Execution : this(targetsToBuild, hostServices, flags, FileUtilities.NormalizePath(projectFullPath)!) { ErrorUtilities.VerifyThrowArgumentLength(projectFullPath, nameof(projectFullPath)); - ErrorUtilities.VerifyThrowArgumentNull(globalProperties, nameof(globalProperties)); + ErrorUtilities.VerifyThrowArgumentNull(globalProperties); GlobalPropertiesDictionary = new PropertyDictionary(globalProperties.Count); foreach (KeyValuePair propertyPair in globalProperties) diff --git a/src/Build/BackEnd/BuildManager/BuildRequestDataBase.cs b/src/Build/BackEnd/BuildManager/BuildRequestDataBase.cs index c31381c083..9872d24ae6 100644 --- a/src/Build/BackEnd/BuildManager/BuildRequestDataBase.cs +++ b/src/Build/BackEnd/BuildManager/BuildRequestDataBase.cs @@ -13,7 +13,7 @@ namespace Microsoft.Build.Execution BuildRequestDataFlags flags, HostServices? hostServices) { - ErrorUtilities.VerifyThrowArgumentNull(targetNames, nameof(targetNames)); + ErrorUtilities.VerifyThrowArgumentNull(targetNames); foreach (string targetName in targetNames) { ErrorUtilities.VerifyThrowArgumentNull(targetName, "target"); diff --git a/src/Build/BackEnd/BuildManager/BuildSubmission.cs b/src/Build/BackEnd/BuildManager/BuildSubmission.cs index 7ef719402d..7d996548bd 100644 --- a/src/Build/BackEnd/BuildManager/BuildSubmission.cs +++ b/src/Build/BackEnd/BuildManager/BuildSubmission.cs @@ -35,7 +35,7 @@ namespace Microsoft.Build.Execution protected internal BuildSubmissionBase(BuildManager buildManager, int submissionId, TRequestData requestData) : base(buildManager, submissionId) { - ErrorUtilities.VerifyThrowArgumentNull(requestData, nameof(requestData)); + ErrorUtilities.VerifyThrowArgumentNull(requestData); BuildRequestData = requestData; } @@ -77,7 +77,7 @@ namespace Microsoft.Build.Execution /// internal void CompleteResults(TResultData result) { - ErrorUtilities.VerifyThrowArgumentNull(result, nameof(result)); + ErrorUtilities.VerifyThrowArgumentNull(result); CheckResultValidForCompletion(result); BuildResult ??= result; diff --git a/src/Build/BackEnd/BuildManager/BuildSubmissionBase.cs b/src/Build/BackEnd/BuildManager/BuildSubmissionBase.cs index 1cf4819c51..719625f43d 100644 --- a/src/Build/BackEnd/BuildManager/BuildSubmissionBase.cs +++ b/src/Build/BackEnd/BuildManager/BuildSubmissionBase.cs @@ -40,7 +40,7 @@ namespace Microsoft.Build.Execution /// protected internal BuildSubmissionBase(BuildManager buildManager, int submissionId) { - ErrorUtilities.VerifyThrowArgumentNull(buildManager, nameof(buildManager)); + ErrorUtilities.VerifyThrowArgumentNull(buildManager); BuildManager = buildManager; SubmissionId = submissionId; diff --git a/src/Build/BackEnd/Client/MSBuildClientPacketPump.cs b/src/Build/BackEnd/Client/MSBuildClientPacketPump.cs index 9e9ee1d0bf..65a7b72a4d 100644 --- a/src/Build/BackEnd/Client/MSBuildClientPacketPump.cs +++ b/src/Build/BackEnd/Client/MSBuildClientPacketPump.cs @@ -75,7 +75,7 @@ namespace Microsoft.Build.BackEnd.Client public MSBuildClientPacketPump(Stream stream) { - ErrorUtilities.VerifyThrowArgumentNull(stream, nameof(stream)); + ErrorUtilities.VerifyThrowArgumentNull(stream); _stream = stream; _isServerDisconnecting = false; diff --git a/src/Build/BackEnd/Components/BuildRequestEngine/BuildRequestEngine.cs b/src/Build/BackEnd/Components/BuildRequestEngine/BuildRequestEngine.cs index ed79f9d09d..9c633d14b8 100644 --- a/src/Build/BackEnd/Components/BuildRequestEngine/BuildRequestEngine.cs +++ b/src/Build/BackEnd/Components/BuildRequestEngine/BuildRequestEngine.cs @@ -590,7 +590,7 @@ namespace Microsoft.Build.BackEnd /// The host. public void InitializeComponent(IBuildComponentHost host) { - ErrorUtilities.VerifyThrowArgumentNull(host, nameof(host)); + ErrorUtilities.VerifyThrowArgumentNull(host); ErrorUtilities.VerifyThrow(_componentHost == null, "BuildRequestEngine already initialized!"); _componentHost = host; _configCache = (IConfigCache)host.GetComponent(BuildComponentType.ConfigCache); @@ -1330,7 +1330,7 @@ namespace Microsoft.Build.BackEnd private void IssueConfigurationRequest(BuildRequestConfiguration config) { ErrorUtilities.VerifyThrow(config.WasGeneratedByNode, "InvalidConfigurationId"); - ErrorUtilities.VerifyThrowArgumentNull(config, nameof(config)); + ErrorUtilities.VerifyThrowArgumentNull(config); ErrorUtilities.VerifyThrow(_unresolvedConfigurations.HasConfiguration(config.ConfigurationId), "NoUnresolvedConfiguration"); TraceEngine("Issuing configuration request for node config {0}", config.ConfigurationId); RaiseNewConfigurationRequest(config); @@ -1342,7 +1342,7 @@ namespace Microsoft.Build.BackEnd /// The information about why the request is blocked. private void IssueBuildRequest(BuildRequestBlocker blocker) { - ErrorUtilities.VerifyThrowArgumentNull(blocker, nameof(blocker)); + ErrorUtilities.VerifyThrowArgumentNull(blocker); if (blocker.BuildRequests == null) { diff --git a/src/Build/BackEnd/Components/BuildRequestEngine/BuildRequestEntry.cs b/src/Build/BackEnd/Components/BuildRequestEngine/BuildRequestEntry.cs index e7eb367546..28466f039c 100644 --- a/src/Build/BackEnd/Components/BuildRequestEngine/BuildRequestEntry.cs +++ b/src/Build/BackEnd/Components/BuildRequestEngine/BuildRequestEntry.cs @@ -122,8 +122,8 @@ namespace Microsoft.Build.BackEnd /// The build request configuration. internal BuildRequestEntry(BuildRequest request, BuildRequestConfiguration requestConfiguration) { - ErrorUtilities.VerifyThrowArgumentNull(request, nameof(request)); - ErrorUtilities.VerifyThrowArgumentNull(requestConfiguration, nameof(requestConfiguration)); + ErrorUtilities.VerifyThrowArgumentNull(request); + ErrorUtilities.VerifyThrowArgumentNull(requestConfiguration); ErrorUtilities.VerifyThrow(requestConfiguration.ConfigurationId == request.ConfigurationId, "Configuration id mismatch"); GlobalLock = new Object(); @@ -303,7 +303,7 @@ namespace Microsoft.Build.BackEnd { lock (GlobalLock) { - ErrorUtilities.VerifyThrowArgumentNull(result, nameof(result)); + ErrorUtilities.VerifyThrowArgumentNull(result); ErrorUtilities.VerifyThrow(State == BuildRequestEntryState.Waiting || _outstandingRequests == null, "Entry must be in the Waiting state to report results, or we must have flushed our requests due to an error. Config: {0} State: {1} Requests: {2}", RequestConfiguration.ConfigurationId, State, _outstandingRequests != null); // If the matching request is in the issue list, remove it so we don't try to ask for it to be built. @@ -471,7 +471,7 @@ namespace Microsoft.Build.BackEnd { lock (GlobalLock) { - ErrorUtilities.VerifyThrowArgumentNull(result, nameof(result)); + ErrorUtilities.VerifyThrowArgumentNull(result); ErrorUtilities.VerifyThrow(Result == null, "Entry already Completed."); // If this request is determined to be a success, then all outstanding items must have been taken care of diff --git a/src/Build/BackEnd/Components/BuildRequestEngine/FullyQualifiedBuildRequest.cs b/src/Build/BackEnd/Components/BuildRequestEngine/FullyQualifiedBuildRequest.cs index f096ca4d52..d4afd3de4f 100644 --- a/src/Build/BackEnd/Components/BuildRequestEngine/FullyQualifiedBuildRequest.cs +++ b/src/Build/BackEnd/Components/BuildRequestEngine/FullyQualifiedBuildRequest.cs @@ -35,8 +35,8 @@ namespace Microsoft.Build.BackEnd bool skipStaticGraphIsolationConstraints = false, BuildRequestDataFlags flags = BuildRequestDataFlags.None) { - ErrorUtilities.VerifyThrowArgumentNull(config, nameof(config)); - ErrorUtilities.VerifyThrowArgumentNull(targets, nameof(targets)); + ErrorUtilities.VerifyThrowArgumentNull(config); + ErrorUtilities.VerifyThrowArgumentNull(targets); Config = config; Targets = targets; diff --git a/src/Build/BackEnd/Components/Caching/ConfigCache.cs b/src/Build/BackEnd/Components/Caching/ConfigCache.cs index 7bc41b7775..b628e76452 100644 --- a/src/Build/BackEnd/Components/Caching/ConfigCache.cs +++ b/src/Build/BackEnd/Components/Caching/ConfigCache.cs @@ -73,7 +73,7 @@ namespace Microsoft.Build.BackEnd /// The configuration to add. public void AddConfiguration(BuildRequestConfiguration config) { - ErrorUtilities.VerifyThrowArgumentNull(config, nameof(config)); + ErrorUtilities.VerifyThrowArgumentNull(config); ErrorUtilities.VerifyThrow(config.ConfigurationId != 0, "Invalid configuration ID"); lock (_lockObject) @@ -107,7 +107,7 @@ namespace Microsoft.Build.BackEnd /// A matching configuration if one exists, null otherwise. public BuildRequestConfiguration GetMatchingConfiguration(BuildRequestConfiguration config) { - ErrorUtilities.VerifyThrowArgumentNull(config, nameof(config)); + ErrorUtilities.VerifyThrowArgumentNull(config); return GetMatchingConfiguration(new ConfigurationMetadata(config)); } @@ -118,7 +118,7 @@ namespace Microsoft.Build.BackEnd /// A matching configuration if one exists, null otherwise. public BuildRequestConfiguration GetMatchingConfiguration(ConfigurationMetadata configMetadata) { - ErrorUtilities.VerifyThrowArgumentNull(configMetadata, nameof(configMetadata)); + ErrorUtilities.VerifyThrowArgumentNull(configMetadata); lock (_lockObject) { if (!_configurationIdsByMetadata.TryGetValue(configMetadata, out int configId)) @@ -341,7 +341,7 @@ namespace Microsoft.Build.BackEnd /// The build component host. public void InitializeComponent(IBuildComponentHost host) { - ErrorUtilities.VerifyThrowArgumentNull(host, nameof(host)); + ErrorUtilities.VerifyThrowArgumentNull(host); } /// diff --git a/src/Build/BackEnd/Components/Caching/ResultsCache.cs b/src/Build/BackEnd/Components/Caching/ResultsCache.cs index e34dd90c5b..14ce0a38b4 100644 --- a/src/Build/BackEnd/Components/Caching/ResultsCache.cs +++ b/src/Build/BackEnd/Components/Caching/ResultsCache.cs @@ -281,7 +281,7 @@ namespace Microsoft.Build.BackEnd /// The component host. public void InitializeComponent(IBuildComponentHost host) { - ErrorUtilities.VerifyThrowArgumentNull(host, nameof(host)); + ErrorUtilities.VerifyThrowArgumentNull(host); } /// @@ -350,7 +350,7 @@ namespace Microsoft.Build.BackEnd /// The candidate build result. /// True if the flags and project state filter of the build request is compatible with the build result. private static bool AreBuildResultFlagsCompatible(BuildRequest buildRequest, BuildResult buildResult) - { + { if (buildResult.BuildRequestDataFlags is null) { return true; diff --git a/src/Build/BackEnd/Components/Communications/NodeEndpointInProc.cs b/src/Build/BackEnd/Components/Communications/NodeEndpointInProc.cs index 70ec3d4148..7b5274452e 100644 --- a/src/Build/BackEnd/Components/Communications/NodeEndpointInProc.cs +++ b/src/Build/BackEnd/Components/Communications/NodeEndpointInProc.cs @@ -101,7 +101,7 @@ namespace Microsoft.Build.BackEnd /// The component host. private NodeEndpointInProc(EndpointMode commMode, IBuildComponentHost host) { - ErrorUtilities.VerifyThrowArgumentNull(host, nameof(host)); + ErrorUtilities.VerifyThrowArgumentNull(host); _status = LinkStatus.Inactive; _mode = commMode; @@ -331,7 +331,7 @@ namespace Microsoft.Build.BackEnd /// The packet to be transmitted. private void EnqueuePacket(INodePacket packet) { - ErrorUtilities.VerifyThrowArgumentNull(packet, nameof(packet)); + ErrorUtilities.VerifyThrowArgumentNull(packet); ErrorUtilities.VerifyThrow(_mode == EndpointMode.Asynchronous, "EndPoint mode is synchronous, should be asynchronous"); ErrorUtilities.VerifyThrow(_packetQueue != null, "packetQueue is null"); ErrorUtilities.VerifyThrow(_packetAvailable != null, "packetAvailable is null"); diff --git a/src/Build/BackEnd/Components/Communications/NodeProviderInProc.cs b/src/Build/BackEnd/Components/Communications/NodeProviderInProc.cs index 26cf8ed28f..15c815fb9c 100644 --- a/src/Build/BackEnd/Components/Communications/NodeProviderInProc.cs +++ b/src/Build/BackEnd/Components/Communications/NodeProviderInProc.cs @@ -157,7 +157,7 @@ namespace Microsoft.Build.BackEnd public void SendData(int nodeId, INodePacket packet) { ErrorUtilities.VerifyThrowArgumentOutOfRange(nodeId == _inProcNodeId, "node"); - ErrorUtilities.VerifyThrowArgumentNull(packet, nameof(packet)); + ErrorUtilities.VerifyThrowArgumentNull(packet); if (_inProcNode == null) { diff --git a/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProc.cs b/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProc.cs index c5f2aa282f..3fb64eb9fb 100644 --- a/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProc.cs +++ b/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProc.cs @@ -78,7 +78,7 @@ namespace Microsoft.Build.BackEnd /// public IList CreateNodes(int nextNodeId, INodePacketFactory factory, Func configurationFactory, int numberOfNodesToCreate) { - ErrorUtilities.VerifyThrowArgumentNull(factory, nameof(factory)); + ErrorUtilities.VerifyThrowArgumentNull(factory); // This can run concurrently. To be properly detect internal bug when we create more nodes than allowed // we add into _nodeContexts premise of future node and verify that it will not cross limits. diff --git a/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs b/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs index 99e706d248..2395b09f44 100644 --- a/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs +++ b/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs @@ -95,7 +95,7 @@ namespace Microsoft.Build.BackEnd /// The packet to send. protected void SendData(NodeContext context, INodePacket packet) { - ErrorUtilities.VerifyThrowArgumentNull(packet, nameof(packet)); + ErrorUtilities.VerifyThrowArgumentNull(packet); context.SendData(packet); } diff --git a/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs b/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs index 03a45a0e6b..1d0f0f525d 100644 --- a/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs +++ b/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs @@ -527,7 +527,7 @@ namespace Microsoft.Build.BackEnd /// internal bool CreateNode(HandshakeOptions hostContext, INodePacketFactory factory, INodePacketHandler handler, TaskHostConfiguration configuration) { - ErrorUtilities.VerifyThrowArgumentNull(factory, nameof(factory)); + ErrorUtilities.VerifyThrowArgumentNull(factory); ErrorUtilities.VerifyThrow(!_nodeIdToPacketFactory.ContainsKey((int)hostContext), "We should not already have a factory for this context! Did we forget to call DisconnectFromHost somewhere?"); if (AvailableNodes <= 0) diff --git a/src/Build/BackEnd/Components/Logging/ForwardingLoggerRecord.cs b/src/Build/BackEnd/Components/Logging/ForwardingLoggerRecord.cs index 4b7a6beffe..20131c8bb7 100644 --- a/src/Build/BackEnd/Components/Logging/ForwardingLoggerRecord.cs +++ b/src/Build/BackEnd/Components/Logging/ForwardingLoggerRecord.cs @@ -21,7 +21,7 @@ namespace Microsoft.Build.Logging public ForwardingLoggerRecord(ILogger centralLogger, LoggerDescription forwardingLoggerDescription) { // The logging service allows a null central logger, so we don't check for it here. - ErrorUtilities.VerifyThrowArgumentNull(forwardingLoggerDescription, nameof(forwardingLoggerDescription)); + ErrorUtilities.VerifyThrowArgumentNull(forwardingLoggerDescription); this.CentralLogger = centralLogger; this.ForwardingLoggerDescription = forwardingLoggerDescription; diff --git a/src/Build/BackEnd/Components/Logging/LoggingContext.cs b/src/Build/BackEnd/Components/Logging/LoggingContext.cs index 6c871f7667..a0c565ad49 100644 --- a/src/Build/BackEnd/Components/Logging/LoggingContext.cs +++ b/src/Build/BackEnd/Components/Logging/LoggingContext.cs @@ -42,8 +42,8 @@ namespace Microsoft.Build.BackEnd.Logging /// The event context public LoggingContext(ILoggingService loggingService, BuildEventContext eventContext) { - ErrorUtilities.VerifyThrowArgumentNull(loggingService, nameof(loggingService)); - ErrorUtilities.VerifyThrowArgumentNull(eventContext, nameof(eventContext)); + ErrorUtilities.VerifyThrowArgumentNull(loggingService); + ErrorUtilities.VerifyThrowArgumentNull(eventContext); _loggingService = loggingService; _eventContext = eventContext; diff --git a/src/Build/BackEnd/Components/RequestBuilder/RequestBuilder.cs b/src/Build/BackEnd/Components/RequestBuilder/RequestBuilder.cs index 0d9b660b45..d93803fdda 100644 --- a/src/Build/BackEnd/Components/RequestBuilder/RequestBuilder.cs +++ b/src/Build/BackEnd/Components/RequestBuilder/RequestBuilder.cs @@ -196,8 +196,8 @@ namespace Microsoft.Build.BackEnd /// The entry to build. public void BuildRequest(NodeLoggingContext loggingContext, BuildRequestEntry entry) { - ErrorUtilities.VerifyThrowArgumentNull(loggingContext, nameof(loggingContext)); - ErrorUtilities.VerifyThrowArgumentNull(entry, nameof(entry)); + ErrorUtilities.VerifyThrowArgumentNull(loggingContext); + ErrorUtilities.VerifyThrowArgumentNull(entry); ErrorUtilities.VerifyThrow(_componentHost != null, "Host not set."); ErrorUtilities.VerifyThrow(_targetBuilder == null, "targetBuilder not null"); ErrorUtilities.VerifyThrow(_nodeLoggingContext == null, "nodeLoggingContext not null"); @@ -332,10 +332,10 @@ namespace Microsoft.Build.BackEnd public async Task BuildProjects(string[] projectFiles, PropertyDictionary[] properties, string[] toolsVersions, string[] targets, bool waitForResults, bool skipNonexistentTargets = false) { VerifyIsNotZombie(); - ErrorUtilities.VerifyThrowArgumentNull(projectFiles, nameof(projectFiles)); - ErrorUtilities.VerifyThrowArgumentNull(properties, nameof(properties)); - ErrorUtilities.VerifyThrowArgumentNull(targets, nameof(targets)); - ErrorUtilities.VerifyThrowArgumentNull(toolsVersions, nameof(toolsVersions)); + ErrorUtilities.VerifyThrowArgumentNull(projectFiles); + ErrorUtilities.VerifyThrowArgumentNull(properties); + ErrorUtilities.VerifyThrowArgumentNull(targets); + ErrorUtilities.VerifyThrowArgumentNull(toolsVersions); ErrorUtilities.VerifyThrow(_componentHost != null, "No host object set"); ErrorUtilities.VerifyThrow(projectFiles.Length == properties.Length, "Properties and project counts not the same"); ErrorUtilities.VerifyThrow(projectFiles.Length == toolsVersions.Length, "Tools versions and project counts not the same"); @@ -550,7 +550,7 @@ namespace Microsoft.Build.BackEnd /// The component host. public void InitializeComponent(IBuildComponentHost host) { - ErrorUtilities.VerifyThrowArgumentNull(host, nameof(host)); + ErrorUtilities.VerifyThrowArgumentNull(host); ErrorUtilities.VerifyThrow(_componentHost == null, "RequestBuilder already initialized."); _componentHost = host; } @@ -1105,7 +1105,7 @@ namespace Microsoft.Build.BackEnd { ErrorUtilities.VerifyThrow(_targetBuilder != null, "Target builder is null"); - // We consider this the entrypoint for the project build for purposes of BuildCheck processing + // We consider this the entrypoint for the project build for purposes of BuildCheck processing bool isRestoring = _requestEntry.RequestConfiguration.GlobalProperties[MSBuildConstants.MSBuildIsRestoring] is not null; var buildCheckManager = isRestoring @@ -1155,7 +1155,7 @@ namespace Microsoft.Build.BackEnd _requestEntry.Request.BuildEventContext); } - + try { HandleProjectStarted(buildCheckManager); diff --git a/src/Build/BackEnd/Components/RequestBuilder/TargetBuilder.cs b/src/Build/BackEnd/Components/RequestBuilder/TargetBuilder.cs index 4961d48c59..deafed1742 100644 --- a/src/Build/BackEnd/Components/RequestBuilder/TargetBuilder.cs +++ b/src/Build/BackEnd/Components/RequestBuilder/TargetBuilder.cs @@ -103,10 +103,10 @@ namespace Microsoft.Build.BackEnd public async Task BuildTargets(ProjectLoggingContext loggingContext, BuildRequestEntry entry, IRequestBuilderCallback callback, (string name, TargetBuiltReason reason)[] targetNames, Lookup baseLookup, CancellationToken cancellationToken) { ErrorUtilities.VerifyThrowArgumentNull(loggingContext, "projectLoggingContext"); - ErrorUtilities.VerifyThrowArgumentNull(entry, nameof(entry)); + ErrorUtilities.VerifyThrowArgumentNull(entry); ErrorUtilities.VerifyThrowArgumentNull(callback, "requestBuilderCallback"); - ErrorUtilities.VerifyThrowArgumentNull(targetNames, nameof(targetNames)); - ErrorUtilities.VerifyThrowArgumentNull(baseLookup, nameof(baseLookup)); + ErrorUtilities.VerifyThrowArgumentNull(targetNames); + ErrorUtilities.VerifyThrowArgumentNull(baseLookup); ErrorUtilities.VerifyThrow(targetNames.Length > 0, "List of targets must be non-empty"); ErrorUtilities.VerifyThrow(_componentHost != null, "InitializeComponent must be called before building targets."); @@ -212,7 +212,7 @@ namespace Microsoft.Build.BackEnd /// The component host. public void InitializeComponent(IBuildComponentHost host) { - ErrorUtilities.VerifyThrowArgumentNull(host, nameof(host)); + ErrorUtilities.VerifyThrowArgumentNull(host); _componentHost = host; } diff --git a/src/Build/BackEnd/Components/RequestBuilder/TargetEntry.cs b/src/Build/BackEnd/Components/RequestBuilder/TargetEntry.cs index bd58c8a419..c85b4f41f5 100644 --- a/src/Build/BackEnd/Components/RequestBuilder/TargetEntry.cs +++ b/src/Build/BackEnd/Components/RequestBuilder/TargetEntry.cs @@ -175,11 +175,11 @@ namespace Microsoft.Build.BackEnd LoggingContext loggingContext, bool stopProcessingOnCompletion) { - ErrorUtilities.VerifyThrowArgumentNull(requestEntry, nameof(requestEntry)); - ErrorUtilities.VerifyThrowArgumentNull(targetBuilderCallback, nameof(targetBuilderCallback)); + ErrorUtilities.VerifyThrowArgumentNull(requestEntry); + ErrorUtilities.VerifyThrowArgumentNull(targetBuilderCallback); ErrorUtilities.VerifyThrowArgumentNull(targetSpecification, "targetName"); ErrorUtilities.VerifyThrowArgumentNull(baseLookup, "lookup"); - ErrorUtilities.VerifyThrowArgumentNull(host, nameof(host)); + ErrorUtilities.VerifyThrowArgumentNull(host); _requestEntry = requestEntry; _targetBuilderCallback = targetBuilderCallback; diff --git a/src/Build/BackEnd/Components/RequestBuilder/TargetSpecification.cs b/src/Build/BackEnd/Components/RequestBuilder/TargetSpecification.cs index 4de22a23cc..041d557942 100644 --- a/src/Build/BackEnd/Components/RequestBuilder/TargetSpecification.cs +++ b/src/Build/BackEnd/Components/RequestBuilder/TargetSpecification.cs @@ -30,7 +30,7 @@ namespace Microsoft.Build.BackEnd internal TargetSpecification(string targetName, ElementLocation referenceLocation, TargetBuiltReason targetBuiltReason = TargetBuiltReason.None) { ErrorUtilities.VerifyThrowArgumentLength(targetName, nameof(targetName)); - ErrorUtilities.VerifyThrowArgumentNull(referenceLocation, nameof(referenceLocation)); + ErrorUtilities.VerifyThrowArgumentNull(referenceLocation); this._targetName = targetName; this._referenceLocation = referenceLocation; diff --git a/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs b/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs index 6bc0dd7fc2..c45130602a 100644 --- a/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs +++ b/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs @@ -293,7 +293,7 @@ namespace Microsoft.Build.BackEnd /// true, if successful private async Task ExecuteTask(TaskExecutionMode mode, Lookup lookup) { - ErrorUtilities.VerifyThrowArgumentNull(lookup, nameof(lookup)); + ErrorUtilities.VerifyThrowArgumentNull(lookup); WorkUnitResult taskResult = new WorkUnitResult(WorkUnitResultCode.Failed, WorkUnitActionCode.Stop, null); TaskHost taskHost = null; diff --git a/src/Build/BackEnd/Components/RequestBuilder/TaskHost.cs b/src/Build/BackEnd/Components/RequestBuilder/TaskHost.cs index 09567c2370..f8367ca997 100644 --- a/src/Build/BackEnd/Components/RequestBuilder/TaskHost.cs +++ b/src/Build/BackEnd/Components/RequestBuilder/TaskHost.cs @@ -114,8 +114,8 @@ namespace Microsoft.Build.BackEnd /// An to use to invoke targets and build projects. public TaskHost(IBuildComponentHost host, BuildRequestEntry requestEntry, ElementLocation taskLocation, ITargetBuilderCallback targetBuilderCallback) { - ErrorUtilities.VerifyThrowArgumentNull(host, nameof(host)); - ErrorUtilities.VerifyThrowArgumentNull(requestEntry, nameof(requestEntry)); + ErrorUtilities.VerifyThrowArgumentNull(host); + ErrorUtilities.VerifyThrowArgumentNull(requestEntry); ErrorUtilities.VerifyThrowInternalNull(taskLocation, nameof(taskLocation)); _host = host; @@ -408,7 +408,7 @@ namespace Microsoft.Build.BackEnd { lock (_callbackMonitor) { - ErrorUtilities.VerifyThrowArgumentNull(e, nameof(e)); + ErrorUtilities.VerifyThrowArgumentNull(e); if (!_activeProxy) { @@ -478,7 +478,7 @@ namespace Microsoft.Build.BackEnd { lock (_callbackMonitor) { - ErrorUtilities.VerifyThrowArgumentNull(e, nameof(e)); + ErrorUtilities.VerifyThrowArgumentNull(e); if (!_activeProxy) { @@ -519,7 +519,7 @@ namespace Microsoft.Build.BackEnd { lock (_callbackMonitor) { - ErrorUtilities.VerifyThrowArgumentNull(e, nameof(e)); + ErrorUtilities.VerifyThrowArgumentNull(e); if (!_activeProxy) { @@ -560,7 +560,7 @@ namespace Microsoft.Build.BackEnd { lock (_callbackMonitor) { - ErrorUtilities.VerifyThrowArgumentNull(e, nameof(e)); + ErrorUtilities.VerifyThrowArgumentNull(e); if (!_activeProxy) { @@ -651,7 +651,7 @@ namespace Microsoft.Build.BackEnd { lock (_callbackMonitor) { - ErrorUtilities.VerifyThrowArgumentNull(eventName, nameof(eventName)); + ErrorUtilities.VerifyThrowArgumentNull(eventName); if (!_activeProxy) { @@ -965,8 +965,8 @@ namespace Microsoft.Build.BackEnd /// public async Task InternalBuildProjects(string[] projectFileNames, string[] targetNames, IDictionary[] globalProperties, IList[] undefineProperties, string[] toolsVersion, bool returnTargetOutputs, bool skipNonexistentTargets = false) { - ErrorUtilities.VerifyThrowArgumentNull(projectFileNames, nameof(projectFileNames)); - ErrorUtilities.VerifyThrowArgumentNull(globalProperties, nameof(globalProperties)); + ErrorUtilities.VerifyThrowArgumentNull(projectFileNames); + ErrorUtilities.VerifyThrowArgumentNull(globalProperties); VerifyActiveProxy(); BuildEngineResult result; @@ -1138,8 +1138,8 @@ namespace Microsoft.Build.BackEnd /// A Task returning a structure containing the result of the build, success or failure and the list of target outputs per project private async Task BuildProjectFilesInParallelAsync(string[] projectFileNames, string[] targetNames, IDictionary[] globalProperties, IList[] undefineProperties, string[] toolsVersion, bool returnTargetOutputs, bool skipNonexistentTargets = false) { - ErrorUtilities.VerifyThrowArgumentNull(projectFileNames, nameof(projectFileNames)); - ErrorUtilities.VerifyThrowArgumentNull(globalProperties, nameof(globalProperties)); + ErrorUtilities.VerifyThrowArgumentNull(projectFileNames); + ErrorUtilities.VerifyThrowArgumentNull(globalProperties); VerifyActiveProxy(); List> targetOutputsPerProject = null; diff --git a/src/Build/BackEnd/Components/Scheduler/SchedulableRequest.cs b/src/Build/BackEnd/Components/Scheduler/SchedulableRequest.cs index 246f6b591b..7ac9baffaf 100644 --- a/src/Build/BackEnd/Components/Scheduler/SchedulableRequest.cs +++ b/src/Build/BackEnd/Components/Scheduler/SchedulableRequest.cs @@ -126,8 +126,8 @@ namespace Microsoft.Build.BackEnd /// public SchedulableRequest(SchedulingData collection, BuildRequest request, SchedulableRequest parent) { - ErrorUtilities.VerifyThrowArgumentNull(collection, nameof(collection)); - ErrorUtilities.VerifyThrowArgumentNull(request, nameof(request)); + ErrorUtilities.VerifyThrowArgumentNull(collection); + ErrorUtilities.VerifyThrowArgumentNull(request); ErrorUtilities.VerifyThrow((parent == null) || (parent._schedulingData == collection), "Parent request does not belong to the same collection."); _schedulingData = collection; @@ -311,7 +311,7 @@ namespace Microsoft.Build.BackEnd public void Yield(string[] activeTargets) { VerifyState(SchedulableRequestState.Executing); - ErrorUtilities.VerifyThrowArgumentNull(activeTargets, nameof(activeTargets)); + ErrorUtilities.VerifyThrowArgumentNull(activeTargets); _activeTargetsWhenBlocked = activeTargets; ChangeToState(SchedulableRequestState.Yielding); } @@ -335,8 +335,8 @@ namespace Microsoft.Build.BackEnd public void BlockByRequest(SchedulableRequest blockingRequest, string[] activeTargets, string blockingTarget = null) { VerifyOneOfStates([SchedulableRequestState.Blocked, SchedulableRequestState.Executing]); - ErrorUtilities.VerifyThrowArgumentNull(blockingRequest, nameof(blockingRequest)); - ErrorUtilities.VerifyThrowArgumentNull(activeTargets, nameof(activeTargets)); + ErrorUtilities.VerifyThrowArgumentNull(blockingRequest); + ErrorUtilities.VerifyThrowArgumentNull(activeTargets); ErrorUtilities.VerifyThrow(BlockingTarget == null, "Cannot block again if we're already blocked on a target"); // Note that the blocking request will typically be our parent UNLESS it is a request we blocked on because it was executing a target we wanted to execute. @@ -372,7 +372,7 @@ namespace Microsoft.Build.BackEnd public void UnblockWithPartialResultForBlockingTarget(BuildResult result) { VerifyOneOfStates([SchedulableRequestState.Blocked, SchedulableRequestState.Unscheduled]); - ErrorUtilities.VerifyThrowArgumentNull(result, nameof(result)); + ErrorUtilities.VerifyThrowArgumentNull(result); BlockingRequestKey key = new BlockingRequestKey(result); DisconnectRequestWeAreBlockedBy(key); @@ -385,7 +385,7 @@ namespace Microsoft.Build.BackEnd public void UnblockWithResult(BuildResult result) { VerifyOneOfStates([SchedulableRequestState.Blocked, SchedulableRequestState.Unscheduled]); - ErrorUtilities.VerifyThrowArgumentNull(result, nameof(result)); + ErrorUtilities.VerifyThrowArgumentNull(result); BlockingRequestKey key = new BlockingRequestKey(result); DisconnectRequestWeAreBlockedBy(key); diff --git a/src/Build/BackEnd/Components/Scheduler/Scheduler.cs b/src/Build/BackEnd/Components/Scheduler/Scheduler.cs index 5fedb8c7ac..210ec0d156 100644 --- a/src/Build/BackEnd/Components/Scheduler/Scheduler.cs +++ b/src/Build/BackEnd/Components/Scheduler/Scheduler.cs @@ -1354,8 +1354,8 @@ namespace Microsoft.Build.BackEnd /// private void AssignUnscheduledRequestToNode(SchedulableRequest request, int nodeId, List responses) { - ErrorUtilities.VerifyThrowArgumentNull(request, nameof(request)); - ErrorUtilities.VerifyThrowArgumentNull(responses, nameof(responses)); + ErrorUtilities.VerifyThrowArgumentNull(request); + ErrorUtilities.VerifyThrowArgumentNull(responses); ErrorUtilities.VerifyThrow(nodeId != InvalidNodeId, "Invalid node id specified."); request.VerifyState(SchedulableRequestState.Unscheduled); @@ -1619,8 +1619,8 @@ namespace Microsoft.Build.BackEnd /// private void HandleRequestBlockedOnInProgressTarget(SchedulableRequest blockedRequest, BuildRequestBlocker blocker) { - ErrorUtilities.VerifyThrowArgumentNull(blockedRequest, nameof(blockedRequest)); - ErrorUtilities.VerifyThrowArgumentNull(blocker, nameof(blocker)); + ErrorUtilities.VerifyThrowArgumentNull(blockedRequest); + ErrorUtilities.VerifyThrowArgumentNull(blocker); // We are blocked on an in-progress request building a target whose results we need. SchedulableRequest blockingRequest = _schedulingData.GetScheduledRequest(blocker.BlockingRequestId); @@ -1678,8 +1678,8 @@ namespace Microsoft.Build.BackEnd /// private void HandleRequestBlockedByNewRequests(SchedulableRequest parentRequest, BuildRequestBlocker blocker, List responses) { - ErrorUtilities.VerifyThrowArgumentNull(blocker, nameof(blocker)); - ErrorUtilities.VerifyThrowArgumentNull(responses, nameof(responses)); + ErrorUtilities.VerifyThrowArgumentNull(blocker); + ErrorUtilities.VerifyThrowArgumentNull(responses); // The request is waiting on new requests. bool abortRequestBatch = false; diff --git a/src/Build/BackEnd/Components/SdkResolution/OutOfProcNodeSdkResolverService.cs b/src/Build/BackEnd/Components/SdkResolution/OutOfProcNodeSdkResolverService.cs index fbd4a2ba24..2472c4c0fc 100644 --- a/src/Build/BackEnd/Components/SdkResolution/OutOfProcNodeSdkResolverService.cs +++ b/src/Build/BackEnd/Components/SdkResolution/OutOfProcNodeSdkResolverService.cs @@ -47,7 +47,7 @@ namespace Microsoft.Build.BackEnd.SdkResolution /// A to use when sending packets to the main node. public OutOfProcNodeSdkResolverService(Action sendPacket) { - ErrorUtilities.VerifyThrowArgumentNull(sendPacket, nameof(sendPacket)); + ErrorUtilities.VerifyThrowArgumentNull(sendPacket); SendPacket = sendPacket; } diff --git a/src/Build/BackEnd/Shared/BuildRequest.cs b/src/Build/BackEnd/Shared/BuildRequest.cs index 8951500b8d..fa76ba4765 100644 --- a/src/Build/BackEnd/Shared/BuildRequest.cs +++ b/src/Build/BackEnd/Shared/BuildRequest.cs @@ -185,7 +185,7 @@ namespace Microsoft.Build.BackEnd : this(submissionId, nodeRequestId, configurationId, hostServices, buildRequestDataFlags, requestedProjectState, projectContextId) { ErrorUtilities.VerifyThrowArgumentNull(escapedTargets, "targets"); - ErrorUtilities.VerifyThrowArgumentNull(parentBuildEventContext, nameof(parentBuildEventContext)); + ErrorUtilities.VerifyThrowArgumentNull(parentBuildEventContext); // When targets come into a build request, we unescape them. _targets = new List(escapedTargets.Count); diff --git a/src/Build/BackEnd/Shared/BuildRequestConfiguration.cs b/src/Build/BackEnd/Shared/BuildRequestConfiguration.cs index 3bca761aab..5046c5d68a 100644 --- a/src/Build/BackEnd/Shared/BuildRequestConfiguration.cs +++ b/src/Build/BackEnd/Shared/BuildRequestConfiguration.cs @@ -167,7 +167,7 @@ namespace Microsoft.Build.BackEnd /// The default ToolsVersion to use as a fallback internal BuildRequestConfiguration(int configId, BuildRequestData data, string defaultToolsVersion) { - ErrorUtilities.VerifyThrowArgumentNull(data, nameof(data)); + ErrorUtilities.VerifyThrowArgumentNull(data); ErrorUtilities.VerifyThrowInternalLength(data.ProjectFullPath, "data.ProjectFullPath"); _configId = configId; @@ -209,7 +209,7 @@ namespace Microsoft.Build.BackEnd /// The project instance. internal BuildRequestConfiguration(int configId, ProjectInstance instance) { - ErrorUtilities.VerifyThrowArgumentNull(instance, nameof(instance)); + ErrorUtilities.VerifyThrowArgumentNull(instance); _configId = configId; _projectFullPath = instance.FullPath; @@ -230,7 +230,7 @@ namespace Microsoft.Build.BackEnd private BuildRequestConfiguration(int configId, BuildRequestConfiguration other) { ErrorUtilities.VerifyThrow(configId != InvalidConfigurationId, "Configuration ID must not be invalid when using this constructor."); - ErrorUtilities.VerifyThrowArgumentNull(other, nameof(other)); + ErrorUtilities.VerifyThrowArgumentNull(other); ErrorUtilities.VerifyThrow(other._transferredState == null, "Unexpected transferred state still set on other configuration."); _project = other._project; diff --git a/src/Build/BackEnd/Shared/BuildRequestUnblocker.cs b/src/Build/BackEnd/Shared/BuildRequestUnblocker.cs index 6f5ab6e48d..8cb838276b 100644 --- a/src/Build/BackEnd/Shared/BuildRequestUnblocker.cs +++ b/src/Build/BackEnd/Shared/BuildRequestUnblocker.cs @@ -52,7 +52,7 @@ namespace Microsoft.Build.BackEnd /// internal BuildRequestUnblocker(BuildResult buildResult) { - ErrorUtilities.VerifyThrowArgumentNull(buildResult, nameof(buildResult)); + ErrorUtilities.VerifyThrowArgumentNull(buildResult); _buildResult = buildResult; _blockedGlobalRequestId = buildResult.ParentGlobalRequestId; } @@ -63,7 +63,7 @@ namespace Microsoft.Build.BackEnd internal BuildRequestUnblocker(BuildRequest parentRequest, BuildResult buildResult) : this(buildResult) { - ErrorUtilities.VerifyThrowArgumentNull(parentRequest, nameof(parentRequest)); + ErrorUtilities.VerifyThrowArgumentNull(parentRequest); _blockedGlobalRequestId = parentRequest.GlobalRequestId; } diff --git a/src/Build/BackEnd/Shared/BuildResult.cs b/src/Build/BackEnd/Shared/BuildResult.cs index b3ce3e8eaf..fd780f44a6 100644 --- a/src/Build/BackEnd/Shared/BuildResult.cs +++ b/src/Build/BackEnd/Shared/BuildResult.cs @@ -523,8 +523,8 @@ namespace Microsoft.Build.Execution /// The results for the target. public void AddResultsForTarget(string target, TargetResult result) { - ErrorUtilities.VerifyThrowArgumentNull(target, nameof(target)); - ErrorUtilities.VerifyThrowArgumentNull(result, nameof(result)); + ErrorUtilities.VerifyThrowArgumentNull(target); + ErrorUtilities.VerifyThrowArgumentNull(result); lock (this) { @@ -564,7 +564,7 @@ namespace Microsoft.Build.Execution /// The results to merge in. public void MergeResults(BuildResult results) { - ErrorUtilities.VerifyThrowArgumentNull(results, nameof(results)); + ErrorUtilities.VerifyThrowArgumentNull(results); ErrorUtilities.VerifyThrow(results.ConfigurationId == ConfigurationId, "Result configurations don't match"); // If we are merging with ourself or with a shallow clone, do nothing. diff --git a/src/Build/BackEnd/Shared/ConfigurationMetadata.cs b/src/Build/BackEnd/Shared/ConfigurationMetadata.cs index c964394f0f..d5b8057016 100644 --- a/src/Build/BackEnd/Shared/ConfigurationMetadata.cs +++ b/src/Build/BackEnd/Shared/ConfigurationMetadata.cs @@ -24,7 +24,7 @@ namespace Microsoft.Build.BackEnd /// public ConfigurationMetadata(BuildRequestConfiguration configuration) { - ErrorUtilities.VerifyThrowArgumentNull(configuration, nameof(configuration)); + ErrorUtilities.VerifyThrowArgumentNull(configuration); _globalProperties = new PropertyDictionary(configuration.GlobalProperties); _projectFullPath = FileUtilities.NormalizePath(configuration.ProjectFullPath); _toolsVersion = configuration.ToolsVersion; @@ -35,7 +35,7 @@ namespace Microsoft.Build.BackEnd /// public ConfigurationMetadata(Project project) { - ErrorUtilities.VerifyThrowArgumentNull(project, nameof(project)); + ErrorUtilities.VerifyThrowArgumentNull(project); _globalProperties = new PropertyDictionary(project.GlobalPropertiesCount); foreach (KeyValuePair entry in project.GlobalPropertiesEnumerable) { @@ -52,7 +52,7 @@ namespace Microsoft.Build.BackEnd public ConfigurationMetadata(string projectFullPath, PropertyDictionary globalProperties) { ErrorUtilities.VerifyThrowArgumentLength(projectFullPath, nameof(projectFullPath)); - ErrorUtilities.VerifyThrowArgumentNull(globalProperties, nameof(globalProperties)); + ErrorUtilities.VerifyThrowArgumentNull(globalProperties); _projectFullPath = projectFullPath; _toolsVersion = MSBuildConstants.CurrentToolsVersion; diff --git a/src/Build/BackEnd/Shared/TargetResult.cs b/src/Build/BackEnd/Shared/TargetResult.cs index 5418d5aee5..d251633ab5 100644 --- a/src/Build/BackEnd/Shared/TargetResult.cs +++ b/src/Build/BackEnd/Shared/TargetResult.cs @@ -65,8 +65,8 @@ namespace Microsoft.Build.Execution /// internal TargetResult(TaskItem[] items, WorkUnitResult result, BuildEventContext originalBuildEventContext = null) { - ErrorUtilities.VerifyThrowArgumentNull(items, nameof(items)); - ErrorUtilities.VerifyThrowArgumentNull(result, nameof(result)); + ErrorUtilities.VerifyThrowArgumentNull(items); + ErrorUtilities.VerifyThrowArgumentNull(result); _items = items; _result = result; _originalBuildEventContext = originalBuildEventContext; diff --git a/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs b/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs index e3a33a5e64..0e4c160336 100644 --- a/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs +++ b/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs @@ -299,8 +299,8 @@ namespace Microsoft.Build.BackEnd /// public bool InitializeForBatch(TaskLoggingContext loggingContext, ItemBucket batchBucket, IDictionary taskIdentityParameters) { - ErrorUtilities.VerifyThrowArgumentNull(loggingContext, nameof(loggingContext)); - ErrorUtilities.VerifyThrowArgumentNull(batchBucket, nameof(batchBucket)); + ErrorUtilities.VerifyThrowArgumentNull(loggingContext); + ErrorUtilities.VerifyThrowArgumentNull(batchBucket); _taskLoggingContext = loggingContext; _batchBucket = batchBucket; @@ -352,7 +352,7 @@ namespace Microsoft.Build.BackEnd /// True if the parameters were set correctly, false otherwise. public bool SetTaskParameters(IDictionary parameters) { - ErrorUtilities.VerifyThrowArgumentNull(parameters, nameof(parameters)); + ErrorUtilities.VerifyThrowArgumentNull(parameters); bool taskInitialized = true; diff --git a/src/Build/Collections/CopyOnReadEnumerable.cs b/src/Build/Collections/CopyOnReadEnumerable.cs index 06956f8361..6ed48e0eed 100644 --- a/src/Build/Collections/CopyOnReadEnumerable.cs +++ b/src/Build/Collections/CopyOnReadEnumerable.cs @@ -44,8 +44,8 @@ namespace Microsoft.Build.Collections /// function to translate items in the backing collection to the resulting type. public CopyOnReadEnumerable(IEnumerable backingEnumerable, object syncRoot, Func selector) { - ErrorUtilities.VerifyThrowArgumentNull(backingEnumerable, nameof(backingEnumerable)); - ErrorUtilities.VerifyThrowArgumentNull(syncRoot, nameof(syncRoot)); + ErrorUtilities.VerifyThrowArgumentNull(backingEnumerable); + ErrorUtilities.VerifyThrowArgumentNull(syncRoot); _backingEnumerable = backingEnumerable; _syncRoot = syncRoot; diff --git a/src/Build/Collections/CopyOnWritePropertyDictionary.cs b/src/Build/Collections/CopyOnWritePropertyDictionary.cs index 44e7fe2055..004f8e484e 100644 --- a/src/Build/Collections/CopyOnWritePropertyDictionary.cs +++ b/src/Build/Collections/CopyOnWritePropertyDictionary.cs @@ -336,7 +336,7 @@ namespace Microsoft.Build.Collections /// public void Set(T projectProperty) { - ErrorUtilities.VerifyThrowArgumentNull(projectProperty, nameof(projectProperty)); + ErrorUtilities.VerifyThrowArgumentNull(projectProperty); _backing = _backing.SetItem(projectProperty.Key, projectProperty); } diff --git a/src/Build/Collections/PropertyDictionary.cs b/src/Build/Collections/PropertyDictionary.cs index c105e12083..fc7dddd3c8 100644 --- a/src/Build/Collections/PropertyDictionary.cs +++ b/src/Build/Collections/PropertyDictionary.cs @@ -475,7 +475,7 @@ namespace Microsoft.Build.Collections /// internal void Set(T projectProperty) { - ErrorUtilities.VerifyThrowArgumentNull(projectProperty, nameof(projectProperty)); + ErrorUtilities.VerifyThrowArgumentNull(projectProperty); lock (_properties) { diff --git a/src/Build/Collections/ReadOnlyConvertingDictionary.cs b/src/Build/Collections/ReadOnlyConvertingDictionary.cs index cc0a4fdac8..6554bd65f6 100644 --- a/src/Build/Collections/ReadOnlyConvertingDictionary.cs +++ b/src/Build/Collections/ReadOnlyConvertingDictionary.cs @@ -34,8 +34,8 @@ namespace Microsoft.Build.Collections /// internal ReadOnlyConvertingDictionary(IDictionary backing, Func converter) { - ErrorUtilities.VerifyThrowArgumentNull(backing, nameof(backing)); - ErrorUtilities.VerifyThrowArgumentNull(converter, nameof(converter)); + ErrorUtilities.VerifyThrowArgumentNull(backing); + ErrorUtilities.VerifyThrowArgumentNull(converter); _backing = backing; _converter = converter; diff --git a/src/Build/Construction/ProjectChooseElement.cs b/src/Build/Construction/ProjectChooseElement.cs index 5977dde4d3..12a7c2866a 100644 --- a/src/Build/Construction/ProjectChooseElement.cs +++ b/src/Build/Construction/ProjectChooseElement.cs @@ -32,7 +32,7 @@ namespace Microsoft.Build.Construction internal ProjectChooseElement(XmlElement xmlElement, ProjectElementContainer parent, ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// diff --git a/src/Build/Construction/ProjectElement.cs b/src/Build/Construction/ProjectElement.cs index a21992f0ca..7776c66787 100644 --- a/src/Build/Construction/ProjectElement.cs +++ b/src/Build/Construction/ProjectElement.cs @@ -49,7 +49,7 @@ namespace Microsoft.Build.Construction /// internal ProjectElement(ProjectElementLink link) { - ErrorUtilities.VerifyThrowArgumentNull(link, nameof(link)); + ErrorUtilities.VerifyThrowArgumentNull(link); _xmlSource = link; } @@ -60,8 +60,8 @@ namespace Microsoft.Build.Construction /// internal ProjectElement(XmlElement xmlElement, ProjectElementContainer parent, ProjectRootElement containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(xmlElement, nameof(xmlElement)); - ErrorUtilities.VerifyThrowArgumentNull(containingProject, nameof(containingProject)); + ErrorUtilities.VerifyThrowArgumentNull(xmlElement); + ErrorUtilities.VerifyThrowArgumentNull(containingProject); _xmlSource = (XmlElementWithLocation)xmlElement; _parent = parent; @@ -350,7 +350,7 @@ namespace Microsoft.Build.Construction /// The element to act as a template to copy from. public virtual void CopyFrom(ProjectElement element) { - ErrorUtilities.VerifyThrowArgumentNull(element, nameof(element)); + ErrorUtilities.VerifyThrowArgumentNull(element); ErrorUtilities.VerifyThrowArgument(GetType().IsEquivalentTo(element.GetType()), "CannotCopyFromElementOfThatType"); if (this == element) diff --git a/src/Build/Construction/ProjectElementContainer.cs b/src/Build/Construction/ProjectElementContainer.cs index 5cf6937f14..c8fabf3559 100644 --- a/src/Build/Construction/ProjectElementContainer.cs +++ b/src/Build/Construction/ProjectElementContainer.cs @@ -142,7 +142,7 @@ namespace Microsoft.Build.Construction /// public void InsertAfterChild(ProjectElement child, ProjectElement reference) { - ErrorUtilities.VerifyThrowArgumentNull(child, nameof(child)); + ErrorUtilities.VerifyThrowArgumentNull(child); if (Link != null) { ContainerLink.InsertAfterChild(child, reference); @@ -197,7 +197,7 @@ namespace Microsoft.Build.Construction /// public void InsertBeforeChild(ProjectElement child, ProjectElement reference) { - ErrorUtilities.VerifyThrowArgumentNull(child, nameof(child)); + ErrorUtilities.VerifyThrowArgumentNull(child); if (Link != null) { @@ -292,7 +292,7 @@ namespace Microsoft.Build.Construction /// public void RemoveChild(ProjectElement child) { - ErrorUtilities.VerifyThrowArgumentNull(child, nameof(child)); + ErrorUtilities.VerifyThrowArgumentNull(child); ErrorUtilities.VerifyThrowArgument(child.Parent == this, "OM_NodeNotAlreadyParentedByThis"); @@ -351,7 +351,7 @@ namespace Microsoft.Build.Construction /// The element to act as a template to copy from. public virtual void DeepCopyFrom(ProjectElementContainer element) { - ErrorUtilities.VerifyThrowArgumentNull(element, nameof(element)); + ErrorUtilities.VerifyThrowArgumentNull(element); ErrorUtilities.VerifyThrowArgument(GetType().IsEquivalentTo(element.GetType()), "CannotCopyFromElementOfThatType"); if (this == element) @@ -835,7 +835,7 @@ namespace Microsoft.Build.Construction public void CopyTo(T[] array, int arrayIndex) { - ErrorUtilities.VerifyThrowArgumentNull(array, nameof(array)); + ErrorUtilities.VerifyThrowArgumentNull(array); if (_realizedElements != null) { @@ -864,7 +864,7 @@ namespace Microsoft.Build.Construction void ICollection.CopyTo(Array array, int index) { - ErrorUtilities.VerifyThrowArgumentNull(array, nameof(array)); + ErrorUtilities.VerifyThrowArgumentNull(array); int i = index; foreach (T entry in this) diff --git a/src/Build/Construction/ProjectExtensionsElement.cs b/src/Build/Construction/ProjectExtensionsElement.cs index 7674069b67..f2c5c738b7 100644 --- a/src/Build/Construction/ProjectExtensionsElement.cs +++ b/src/Build/Construction/ProjectExtensionsElement.cs @@ -35,7 +35,7 @@ namespace Microsoft.Build.Construction internal ProjectExtensionsElement(XmlElement xmlElement, ProjectRootElement parent, ProjectRootElement project) : base(xmlElement, parent, project) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// @@ -161,7 +161,7 @@ namespace Microsoft.Build.Construction /// public override void CopyFrom(ProjectElement element) { - ErrorUtilities.VerifyThrowArgumentNull(element, nameof(element)); + ErrorUtilities.VerifyThrowArgumentNull(element); ErrorUtilities.VerifyThrowArgument(GetType().IsEquivalentTo(element.GetType()), "CannotCopyFromElementOfThatType"); if (this == element) diff --git a/src/Build/Construction/ProjectImportElement.cs b/src/Build/Construction/ProjectImportElement.cs index 89c9202364..6bbc04a9e7 100644 --- a/src/Build/Construction/ProjectImportElement.cs +++ b/src/Build/Construction/ProjectImportElement.cs @@ -35,7 +35,7 @@ namespace Microsoft.Build.Construction internal ProjectImportElement(XmlElementWithLocation xmlElement, ProjectElementContainer parent, ProjectRootElement containingProject, SdkReference sdkReference = null) : base(xmlElement, parent, containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); SdkReference = sdkReference; } diff --git a/src/Build/Construction/ProjectImportGroupElement.cs b/src/Build/Construction/ProjectImportGroupElement.cs index d513117481..0c3b3ac629 100644 --- a/src/Build/Construction/ProjectImportGroupElement.cs +++ b/src/Build/Construction/ProjectImportGroupElement.cs @@ -31,7 +31,7 @@ namespace Microsoft.Build.Construction internal ProjectImportGroupElement(XmlElementWithLocation xmlElement, ProjectElementContainer parent, ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// diff --git a/src/Build/Construction/ProjectItemDefinitionElement.cs b/src/Build/Construction/ProjectItemDefinitionElement.cs index d659c62c18..277ad94c8d 100644 --- a/src/Build/Construction/ProjectItemDefinitionElement.cs +++ b/src/Build/Construction/ProjectItemDefinitionElement.cs @@ -31,7 +31,7 @@ namespace Microsoft.Build.Construction internal ProjectItemDefinitionElement(XmlElement xmlElement, ProjectItemDefinitionGroupElement parent, ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// @@ -73,7 +73,7 @@ namespace Microsoft.Build.Construction public ProjectMetadataElement AddMetadata(string name, string unevaluatedValue, bool expressAsAttribute) { ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); - ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue, nameof(unevaluatedValue)); + ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue); if (expressAsAttribute) { diff --git a/src/Build/Construction/ProjectItemDefinitionGroupElement.cs b/src/Build/Construction/ProjectItemDefinitionGroupElement.cs index 36a034e32d..782becaa1b 100644 --- a/src/Build/Construction/ProjectItemDefinitionGroupElement.cs +++ b/src/Build/Construction/ProjectItemDefinitionGroupElement.cs @@ -31,7 +31,7 @@ namespace Microsoft.Build.Construction internal ProjectItemDefinitionGroupElement(XmlElement xmlElement, ProjectElementContainer parent, ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// diff --git a/src/Build/Construction/ProjectItemElement.cs b/src/Build/Construction/ProjectItemElement.cs index 27856edbea..367422480c 100644 --- a/src/Build/Construction/ProjectItemElement.cs +++ b/src/Build/Construction/ProjectItemElement.cs @@ -65,7 +65,7 @@ namespace Microsoft.Build.Construction internal ProjectItemElement(XmlElementWithLocation xmlElement, ProjectItemGroupElement parent, ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// @@ -390,7 +390,7 @@ namespace Microsoft.Build.Construction public ProjectMetadataElement AddMetadata(string name, string unevaluatedValue, bool expressAsAttribute) { ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); - ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue, nameof(unevaluatedValue)); + ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue); if (expressAsAttribute) { diff --git a/src/Build/Construction/ProjectItemGroupElement.cs b/src/Build/Construction/ProjectItemGroupElement.cs index bf74c24a29..b5e796d9a6 100644 --- a/src/Build/Construction/ProjectItemGroupElement.cs +++ b/src/Build/Construction/ProjectItemGroupElement.cs @@ -39,7 +39,7 @@ namespace Microsoft.Build.Construction internal ProjectItemGroupElement(XmlElementWithLocation xmlElement, ProjectElementContainer parent, ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// diff --git a/src/Build/Construction/ProjectMetadataElement.cs b/src/Build/Construction/ProjectMetadataElement.cs index ce79f79ba4..7a7342366a 100644 --- a/src/Build/Construction/ProjectMetadataElement.cs +++ b/src/Build/Construction/ProjectMetadataElement.cs @@ -31,7 +31,7 @@ namespace Microsoft.Build.Construction internal ProjectMetadataElement(XmlElementWithLocation xmlElement, ProjectElementContainer parent, ProjectRootElement project) : base(xmlElement, parent, project) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// @@ -89,7 +89,7 @@ namespace Microsoft.Build.Construction return; } - ErrorUtilities.VerifyThrowArgumentNull(value, nameof(Value)); + ErrorUtilities.VerifyThrowArgumentNull(value); Internal.Utilities.SetXmlNodeInnerContents(XmlElement, value); Parent?.UpdateElementValue(this); MarkDirty("Set metadata Value {0}", value); diff --git a/src/Build/Construction/ProjectOnErrorElement.cs b/src/Build/Construction/ProjectOnErrorElement.cs index cad2f56b7e..598ac340c1 100644 --- a/src/Build/Construction/ProjectOnErrorElement.cs +++ b/src/Build/Construction/ProjectOnErrorElement.cs @@ -29,7 +29,7 @@ namespace Microsoft.Build.Construction internal ProjectOnErrorElement(XmlElementWithLocation xmlElement, ProjectTargetElement parent, ProjectRootElement project) : base(xmlElement, parent, project) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// diff --git a/src/Build/Construction/ProjectOtherwiseElement.cs b/src/Build/Construction/ProjectOtherwiseElement.cs index 2a0ddfb4d0..baa18de429 100644 --- a/src/Build/Construction/ProjectOtherwiseElement.cs +++ b/src/Build/Construction/ProjectOtherwiseElement.cs @@ -30,7 +30,7 @@ namespace Microsoft.Build.Construction internal ProjectOtherwiseElement(XmlElementWithLocation xmlElement, ProjectElementContainer parent, ProjectRootElement project) : base(xmlElement, parent, project) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// diff --git a/src/Build/Construction/ProjectOutputElement.cs b/src/Build/Construction/ProjectOutputElement.cs index 71b9baa98e..b4669f2b9e 100644 --- a/src/Build/Construction/ProjectOutputElement.cs +++ b/src/Build/Construction/ProjectOutputElement.cs @@ -31,7 +31,7 @@ namespace Microsoft.Build.Construction internal ProjectOutputElement(XmlElement xmlElement, ProjectTaskElement parent, ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// diff --git a/src/Build/Construction/ProjectPropertyElement.cs b/src/Build/Construction/ProjectPropertyElement.cs index 8929dea640..4d2970426a 100644 --- a/src/Build/Construction/ProjectPropertyElement.cs +++ b/src/Build/Construction/ProjectPropertyElement.cs @@ -39,7 +39,7 @@ namespace Microsoft.Build.Construction internal ProjectPropertyElement(XmlElementWithLocation xmlElement, ProjectPropertyGroupElement parent, ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// @@ -69,7 +69,7 @@ namespace Microsoft.Build.Construction set { - ErrorUtilities.VerifyThrowArgumentNull(value, nameof(Value)); + ErrorUtilities.VerifyThrowArgumentNull(value); if (Link != null) { PropertyLink.Value = value; diff --git a/src/Build/Construction/ProjectPropertyGroupElement.cs b/src/Build/Construction/ProjectPropertyGroupElement.cs index 16932b3107..808da5e420 100644 --- a/src/Build/Construction/ProjectPropertyGroupElement.cs +++ b/src/Build/Construction/ProjectPropertyGroupElement.cs @@ -31,7 +31,7 @@ namespace Microsoft.Build.Construction internal ProjectPropertyGroupElement(XmlElementWithLocation xmlElement, ProjectElementContainer parent, ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// @@ -59,7 +59,7 @@ namespace Microsoft.Build.Construction public ProjectPropertyElement AddProperty(string name, string unevaluatedValue) { ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); - ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue, nameof(unevaluatedValue)); + ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue); ProjectPropertyElement newProperty = ContainingProject.CreatePropertyElement(name); newProperty.Value = unevaluatedValue; @@ -76,7 +76,7 @@ namespace Microsoft.Build.Construction public ProjectPropertyElement SetProperty(string name, string unevaluatedValue) { ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); - ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue, nameof(unevaluatedValue)); + ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue); foreach (ProjectPropertyElement property in Properties) { diff --git a/src/Build/Construction/ProjectRootElement.cs b/src/Build/Construction/ProjectRootElement.cs index 0dfb5c1e3f..bdeb233738 100644 --- a/src/Build/Construction/ProjectRootElement.cs +++ b/src/Build/Construction/ProjectRootElement.cs @@ -163,8 +163,8 @@ namespace Microsoft.Build.Construction internal ProjectRootElement(XmlReader xmlReader, ProjectRootElementCacheBase projectRootElementCache, bool isExplicitlyLoaded, bool preserveFormatting) { - ErrorUtilities.VerifyThrowArgumentNull(xmlReader, nameof(xmlReader)); - ErrorUtilities.VerifyThrowArgumentNull(projectRootElementCache, nameof(projectRootElementCache)); + ErrorUtilities.VerifyThrowArgumentNull(xmlReader); + ErrorUtilities.VerifyThrowArgumentNull(projectRootElementCache); IsExplicitlyLoaded = isExplicitlyLoaded; ProjectRootElementCache = projectRootElementCache; @@ -182,7 +182,7 @@ namespace Microsoft.Build.Construction /// private ProjectRootElement(ProjectRootElementCacheBase projectRootElementCache, NewProjectFileOptions projectFileOptions) { - ErrorUtilities.VerifyThrowArgumentNull(projectRootElementCache, nameof(projectRootElementCache)); + ErrorUtilities.VerifyThrowArgumentNull(projectRootElementCache); ProjectRootElementCache = projectRootElementCache; _directory = NativeMethodsShared.GetCurrentDirectory(); @@ -216,7 +216,7 @@ namespace Microsoft.Build.Construction { ErrorUtilities.VerifyThrowArgumentLength(path, nameof(path)); ErrorUtilities.VerifyThrowInternalRooted(path); - ErrorUtilities.VerifyThrowArgumentNull(projectRootElementCache, nameof(projectRootElementCache)); + ErrorUtilities.VerifyThrowArgumentNull(projectRootElementCache); ProjectRootElementCache = projectRootElementCache; IncrementVersion(); @@ -238,8 +238,8 @@ namespace Microsoft.Build.Construction /// private ProjectRootElement(XmlDocumentWithLocation document, ProjectRootElementCacheBase projectRootElementCache) { - ErrorUtilities.VerifyThrowArgumentNull(document, nameof(document)); - ErrorUtilities.VerifyThrowArgumentNull(projectRootElementCache, nameof(projectRootElementCache)); + ErrorUtilities.VerifyThrowArgumentNull(document); + ErrorUtilities.VerifyThrowArgumentNull(projectRootElementCache); ProjectRootElementCache = projectRootElementCache; _directory = NativeMethodsShared.GetCurrentDirectory(); @@ -744,7 +744,7 @@ namespace Microsoft.Build.Construction /// public static ProjectRootElement Create(ProjectCollection projectCollection, NewProjectFileOptions projectFileOptions) { - ErrorUtilities.VerifyThrowArgumentNull(projectCollection, nameof(projectCollection)); + ErrorUtilities.VerifyThrowArgumentNull(projectCollection); return Create(projectCollection.ProjectRootElementCache, projectFileOptions); } @@ -783,7 +783,7 @@ namespace Microsoft.Build.Construction public static ProjectRootElement Create(string path, ProjectCollection projectCollection, NewProjectFileOptions newProjectFileOptions) { ErrorUtilities.VerifyThrowArgumentLength(path, nameof(path)); - ErrorUtilities.VerifyThrowArgumentNull(projectCollection, nameof(projectCollection)); + ErrorUtilities.VerifyThrowArgumentNull(projectCollection); var projectRootElement = new ProjectRootElement( projectCollection.ProjectRootElementCache, @@ -820,7 +820,7 @@ namespace Microsoft.Build.Construction /// public static ProjectRootElement Create(XmlReader xmlReader, ProjectCollection projectCollection, bool preserveFormatting) { - ErrorUtilities.VerifyThrowArgumentNull(projectCollection, nameof(projectCollection)); + ErrorUtilities.VerifyThrowArgumentNull(projectCollection); return new ProjectRootElement(xmlReader, projectCollection.ProjectRootElementCache, true /*Explicitly loaded*/, preserveFormatting); @@ -854,7 +854,7 @@ namespace Microsoft.Build.Construction public static ProjectRootElement Open(string path, ProjectCollection projectCollection, bool? preserveFormatting) { ErrorUtilities.VerifyThrowArgumentLength(path, nameof(path)); - ErrorUtilities.VerifyThrowArgumentNull(projectCollection, nameof(projectCollection)); + ErrorUtilities.VerifyThrowArgumentNull(projectCollection); path = FileUtilities.NormalizePath(path); @@ -911,7 +911,7 @@ namespace Microsoft.Build.Construction public static ProjectRootElement TryOpen(string path, ProjectCollection projectCollection, bool? preserveFormatting) { ErrorUtilities.VerifyThrowArgumentLength(path, nameof(path)); - ErrorUtilities.VerifyThrowArgumentNull(projectCollection, nameof(projectCollection)); + ErrorUtilities.VerifyThrowArgumentNull(projectCollection); path = FileUtilities.NormalizePath(path); @@ -1847,7 +1847,7 @@ namespace Microsoft.Build.Construction /// The dirtied project. internal void MarkProjectDirty(Project project) { - ErrorUtilities.VerifyThrowArgumentNull(project, nameof(project)); + ErrorUtilities.VerifyThrowArgumentNull(project); ErrorUtilities.VerifyThrow(Link == null, "Attempt to edit a document that is not backed by a local xml is disallowed."); // Only bubble this event up if the cache knows about this PRE, which is equivalent to diff --git a/src/Build/Construction/ProjectSdkElement.cs b/src/Build/Construction/ProjectSdkElement.cs index 19abbbf834..518cfed796 100644 --- a/src/Build/Construction/ProjectSdkElement.cs +++ b/src/Build/Construction/ProjectSdkElement.cs @@ -28,7 +28,7 @@ namespace Microsoft.Build.Construction ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// diff --git a/src/Build/Construction/ProjectTargetElement.cs b/src/Build/Construction/ProjectTargetElement.cs index f594efaf07..43c83669ab 100644 --- a/src/Build/Construction/ProjectTargetElement.cs +++ b/src/Build/Construction/ProjectTargetElement.cs @@ -41,7 +41,7 @@ namespace Microsoft.Build.Construction internal ProjectTargetElement(XmlElementWithLocation xmlElement, ProjectRootElement parent, ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// diff --git a/src/Build/Construction/ProjectTaskElement.cs b/src/Build/Construction/ProjectTaskElement.cs index 24118a3ae0..cc0d2f02a9 100644 --- a/src/Build/Construction/ProjectTaskElement.cs +++ b/src/Build/Construction/ProjectTaskElement.cs @@ -46,7 +46,7 @@ namespace Microsoft.Build.Construction internal ProjectTaskElement(XmlElementWithLocation xmlElement, ProjectTargetElement parent, ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// @@ -323,7 +323,7 @@ namespace Microsoft.Build.Construction lock (_locker) { ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); - ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue, nameof(unevaluatedValue)); + ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue); ErrorUtilities.VerifyThrowArgument(!XMakeAttributes.IsSpecialTaskAttribute(name), "CannotAccessKnownAttributes", name); _parameters = null; diff --git a/src/Build/Construction/ProjectUsingTaskBodyElement.cs b/src/Build/Construction/ProjectUsingTaskBodyElement.cs index ad1f97ce4a..f776644215 100644 --- a/src/Build/Construction/ProjectUsingTaskBodyElement.cs +++ b/src/Build/Construction/ProjectUsingTaskBodyElement.cs @@ -33,7 +33,7 @@ namespace Microsoft.Build.Construction internal ProjectUsingTaskBodyElement(XmlElementWithLocation xmlElement, ProjectUsingTaskElement parent, ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); VerifyCorrectParent(parent); } diff --git a/src/Build/Construction/ProjectUsingTaskElement.cs b/src/Build/Construction/ProjectUsingTaskElement.cs index 75a989967b..10e310e555 100644 --- a/src/Build/Construction/ProjectUsingTaskElement.cs +++ b/src/Build/Construction/ProjectUsingTaskElement.cs @@ -31,7 +31,7 @@ namespace Microsoft.Build.Construction internal ProjectUsingTaskElement(XmlElementWithLocation xmlElement, ProjectRootElement parent, ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// diff --git a/src/Build/Construction/ProjectUsingTaskParameterElement.cs b/src/Build/Construction/ProjectUsingTaskParameterElement.cs index 636fb17102..814169f658 100644 --- a/src/Build/Construction/ProjectUsingTaskParameterElement.cs +++ b/src/Build/Construction/ProjectUsingTaskParameterElement.cs @@ -31,7 +31,7 @@ namespace Microsoft.Build.Construction internal ProjectUsingTaskParameterElement(XmlElementWithLocation xmlElement, UsingTaskParameterGroupElement parent, ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// diff --git a/src/Build/Construction/ProjectWhenElement.cs b/src/Build/Construction/ProjectWhenElement.cs index a706a66b28..3c0ec109ac 100644 --- a/src/Build/Construction/ProjectWhenElement.cs +++ b/src/Build/Construction/ProjectWhenElement.cs @@ -31,7 +31,7 @@ namespace Microsoft.Build.Construction internal ProjectWhenElement(XmlElement xmlElement, ProjectChooseElement parent, ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); } /// diff --git a/src/Build/Construction/UsingTaskParameterGroupElement.cs b/src/Build/Construction/UsingTaskParameterGroupElement.cs index 9bbc27f71e..f4d34c2790 100644 --- a/src/Build/Construction/UsingTaskParameterGroupElement.cs +++ b/src/Build/Construction/UsingTaskParameterGroupElement.cs @@ -32,7 +32,7 @@ namespace Microsoft.Build.Construction internal UsingTaskParameterGroupElement(XmlElementWithLocation xmlElement, ProjectElementContainer parent, ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); + ErrorUtilities.VerifyThrowArgumentNull(parent); VerifyCorrectParent(parent); } diff --git a/src/Build/Definition/Project.cs b/src/Build/Definition/Project.cs index 3998a51002..51934fa750 100644 --- a/src/Build/Definition/Project.cs +++ b/src/Build/Definition/Project.cs @@ -108,8 +108,8 @@ namespace Microsoft.Build.Evaluation internal Project(ProjectCollection projectCollection, ProjectLink link) { - ErrorUtilities.VerifyThrowArgumentNull(projectCollection, nameof(projectCollection)); - ErrorUtilities.VerifyThrowArgumentNull(link, nameof(link)); + ErrorUtilities.VerifyThrowArgumentNull(projectCollection); + ErrorUtilities.VerifyThrowArgumentNull(link); ProjectCollection = projectCollection; implementationInternal = new ProjectLinkInternalNotImplemented(); implementation = link; @@ -264,9 +264,9 @@ namespace Microsoft.Build.Evaluation private Project(ProjectRootElement xml, IDictionary globalProperties, string toolsVersion, string subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext, IDirectoryCacheFactory directoryCacheFactory, bool interactive) { - ErrorUtilities.VerifyThrowArgumentNull(xml, nameof(xml)); + ErrorUtilities.VerifyThrowArgumentNull(xml); ErrorUtilities.VerifyThrowArgumentLengthIfNotNull(toolsVersion, nameof(toolsVersion)); - ErrorUtilities.VerifyThrowArgumentNull(projectCollection, nameof(projectCollection)); + ErrorUtilities.VerifyThrowArgumentNull(projectCollection); ProjectCollection = projectCollection; var defaultImplementation = new ProjectImpl(this, xml, globalProperties, toolsVersion, subToolsetVersion, loadSettings); implementationInternal = (IProjectLinkInternal)defaultImplementation; @@ -358,9 +358,9 @@ namespace Microsoft.Build.Evaluation private Project(XmlReader xmlReader, IDictionary globalProperties, string toolsVersion, string subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext, IDirectoryCacheFactory directoryCacheFactory, bool interactive) { - ErrorUtilities.VerifyThrowArgumentNull(xmlReader, nameof(xmlReader)); + ErrorUtilities.VerifyThrowArgumentNull(xmlReader); ErrorUtilities.VerifyThrowArgumentLengthIfNotNull(toolsVersion, nameof(toolsVersion)); - ErrorUtilities.VerifyThrowArgumentNull(projectCollection, nameof(projectCollection)); + ErrorUtilities.VerifyThrowArgumentNull(projectCollection); ProjectCollection = projectCollection; var defaultImplementation = new ProjectImpl(this, xmlReader, globalProperties, toolsVersion, subToolsetVersion, loadSettings, evaluationContext); implementationInternal = (IProjectLinkInternal)defaultImplementation; @@ -454,9 +454,9 @@ namespace Microsoft.Build.Evaluation private Project(string projectFile, IDictionary globalProperties, string toolsVersion, string subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext, IDirectoryCacheFactory directoryCacheFactory, bool interactive) { - ErrorUtilities.VerifyThrowArgumentNull(projectFile, nameof(projectFile)); + ErrorUtilities.VerifyThrowArgumentNull(projectFile); ErrorUtilities.VerifyThrowArgumentLengthIfNotNull(toolsVersion, nameof(toolsVersion)); - ErrorUtilities.VerifyThrowArgumentNull(projectCollection, nameof(projectCollection)); + ErrorUtilities.VerifyThrowArgumentNull(projectCollection); ProjectCollection = projectCollection; var defaultImplementation = new ProjectImpl(this, projectFile, globalProperties, toolsVersion, subToolsetVersion, loadSettings, evaluationContext); @@ -850,7 +850,7 @@ namespace Microsoft.Build.Evaluation [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters", Justification = "IItem is an internal interface; this is less confusing to outside customers. ")] public static string GetEvaluatedItemIncludeEscaped(ProjectItem item) { - ErrorUtilities.VerifyThrowArgumentNull(item, nameof(item)); + ErrorUtilities.VerifyThrowArgumentNull(item); return ((IItem)item).EvaluatedIncludeEscaped; } @@ -860,7 +860,7 @@ namespace Microsoft.Build.Evaluation /// public static string GetEvaluatedItemIncludeEscaped(ProjectItemDefinition item) { - ErrorUtilities.VerifyThrowArgumentNull(item, nameof(item)); + ErrorUtilities.VerifyThrowArgumentNull(item); return ((IItem)item).EvaluatedIncludeEscaped; } @@ -1077,7 +1077,7 @@ namespace Microsoft.Build.Evaluation /// public static string GetMetadataValueEscaped(ProjectMetadata metadatum) { - ErrorUtilities.VerifyThrowArgumentNull(metadatum, nameof(metadatum)); + ErrorUtilities.VerifyThrowArgumentNull(metadatum); return metadatum.EvaluatedValueEscaped; } @@ -1088,7 +1088,7 @@ namespace Microsoft.Build.Evaluation [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters", Justification = "IItem is an internal interface; this is less confusing to outside customers. ")] public static string GetMetadataValueEscaped(ProjectItem item, string name) { - ErrorUtilities.VerifyThrowArgumentNull(item, nameof(item)); + ErrorUtilities.VerifyThrowArgumentNull(item); return ((IItem)item).GetMetadataValueEscaped(name); } @@ -1098,7 +1098,7 @@ namespace Microsoft.Build.Evaluation /// public static string GetMetadataValueEscaped(ProjectItemDefinition item, string name) { - ErrorUtilities.VerifyThrowArgumentNull(item, nameof(item)); + ErrorUtilities.VerifyThrowArgumentNull(item); return ((IItem)item).GetMetadataValueEscaped(name); } @@ -1109,7 +1109,7 @@ namespace Microsoft.Build.Evaluation [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters", Justification = "IProperty is an internal interface; this is less confusing to outside customers. ")] public static string GetPropertyValueEscaped(ProjectProperty property) { - ErrorUtilities.VerifyThrowArgumentNull(property, nameof(property)); + ErrorUtilities.VerifyThrowArgumentNull(property); return ((IProperty)property).EvaluatedValueEscaped; } @@ -1879,9 +1879,9 @@ namespace Microsoft.Build.Evaluation /// The to use for evaluation. public ProjectImpl(Project owner, ProjectRootElement xml, IDictionary globalProperties, string toolsVersion, string subToolsetVersion, ProjectLoadSettings loadSettings) { - ErrorUtilities.VerifyThrowArgumentNull(xml, nameof(xml)); + ErrorUtilities.VerifyThrowArgumentNull(xml); ErrorUtilities.VerifyThrowArgumentLengthIfNotNull(toolsVersion, nameof(toolsVersion)); - ErrorUtilities.VerifyThrowArgumentNull(owner, nameof(owner)); + ErrorUtilities.VerifyThrowArgumentNull(owner); Xml = xml; Owner = owner; @@ -1903,9 +1903,9 @@ namespace Microsoft.Build.Evaluation /// The evaluation context to use in case reevaluation is required. public ProjectImpl(Project owner, XmlReader xmlReader, IDictionary globalProperties, string toolsVersion, string subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) { - ErrorUtilities.VerifyThrowArgumentNull(xmlReader, nameof(xmlReader)); + ErrorUtilities.VerifyThrowArgumentNull(xmlReader); ErrorUtilities.VerifyThrowArgumentLengthIfNotNull(toolsVersion, nameof(toolsVersion)); - ErrorUtilities.VerifyThrowArgumentNull(owner, nameof(owner)); + ErrorUtilities.VerifyThrowArgumentNull(owner); Owner = owner; @@ -1938,9 +1938,9 @@ namespace Microsoft.Build.Evaluation /// The evaluation context to use in case reevaluation is required. public ProjectImpl(Project owner, string projectFile, IDictionary globalProperties, string toolsVersion, string subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) { - ErrorUtilities.VerifyThrowArgumentNull(projectFile, nameof(projectFile)); + ErrorUtilities.VerifyThrowArgumentNull(projectFile); ErrorUtilities.VerifyThrowArgumentLengthIfNotNull(toolsVersion, nameof(toolsVersion)); - ErrorUtilities.VerifyThrowArgumentNull(owner, nameof(owner)); + ErrorUtilities.VerifyThrowArgumentNull(owner); Owner = owner; @@ -2925,7 +2925,7 @@ namespace Microsoft.Build.Evaluation public override ProjectProperty SetProperty(string name, string unevaluatedValue) { ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); - ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue, nameof(unevaluatedValue)); + ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue); ProjectProperty property = _data.Properties[name]; @@ -3152,7 +3152,7 @@ namespace Microsoft.Build.Evaluation /// public override bool RemoveProperty(ProjectProperty property) { - ErrorUtilities.VerifyThrowArgumentNull(property, nameof(property)); + ErrorUtilities.VerifyThrowArgumentNull(property); ErrorUtilities.VerifyThrowInvalidOperation(!property.IsReservedProperty, "OM_ReservedName", property.Name); ErrorUtilities.VerifyThrowInvalidOperation(!property.IsGlobalProperty, "OM_GlobalProperty", property.Name); ErrorUtilities.VerifyThrowArgument(property.Xml.Parent != null, "OM_IncorrectObjectAssociation", "ProjectProperty", "Project"); @@ -3214,7 +3214,7 @@ namespace Microsoft.Build.Evaluation /// public override bool RemoveItem(ProjectItem item) { - ErrorUtilities.VerifyThrowArgumentNull(item, nameof(item)); + ErrorUtilities.VerifyThrowArgumentNull(item); ErrorUtilities.VerifyThrowArgument(item.Project == Owner, "OM_IncorrectObjectAssociation", "ProjectItem", "Project"); bool result = RemoveItemHelper(item); @@ -3234,7 +3234,7 @@ namespace Microsoft.Build.Evaluation /// public override void RemoveItems(IEnumerable items) { - ErrorUtilities.VerifyThrowArgumentNull(items, nameof(items)); + ErrorUtilities.VerifyThrowArgumentNull(items); // Copying to a list makes it possible to remove // all items of a particular type with @@ -3257,7 +3257,7 @@ namespace Microsoft.Build.Evaluation /// public override string ExpandString(string unexpandedValue) { - ErrorUtilities.VerifyThrowArgumentNull(unexpandedValue, nameof(unexpandedValue)); + ErrorUtilities.VerifyThrowArgumentNull(unexpandedValue); string result = _data.Expander.ExpandIntoStringAndUnescape(unexpandedValue, ExpanderOptions.ExpandPropertiesAndItems, ProjectFileLocation); @@ -3633,7 +3633,7 @@ namespace Microsoft.Build.Evaluation /// private bool RemoveItemHelper(ProjectItem item) { - ErrorUtilities.VerifyThrowArgumentNull(item, nameof(item)); + ErrorUtilities.VerifyThrowArgumentNull(item); if (item.Project == null || item.Xml.Parent == null) { diff --git a/src/Build/Definition/ProjectCollection.cs b/src/Build/Definition/ProjectCollection.cs index 93e536f0aa..306b8e2216 100644 --- a/src/Build/Definition/ProjectCollection.cs +++ b/src/Build/Definition/ProjectCollection.cs @@ -1010,7 +1010,7 @@ namespace Microsoft.Build.Evaluation /// public void AddToolset(Toolset toolset) { - ErrorUtilities.VerifyThrowArgumentNull(toolset, nameof(toolset)); + ErrorUtilities.VerifyThrowArgumentNull(toolset); using (_locker.EnterDisposableWriteLock()) { _toolsets[toolset.ToolsVersion] = toolset; @@ -1379,7 +1379,7 @@ namespace Microsoft.Build.Evaluation /// public void UnloadProject(ProjectRootElement projectRootElement) { - ErrorUtilities.VerifyThrowArgumentNull(projectRootElement, nameof(projectRootElement)); + ErrorUtilities.VerifyThrowArgumentNull(projectRootElement); if (projectRootElement.Link != null) { return; @@ -1529,7 +1529,7 @@ namespace Microsoft.Build.Evaluation /// The project XML root element to unload. public bool TryUnloadProject(ProjectRootElement projectRootElement) { - ErrorUtilities.VerifyThrowArgumentNull(projectRootElement, nameof(projectRootElement)); + ErrorUtilities.VerifyThrowArgumentNull(projectRootElement); if (projectRootElement.Link != null) { return false; @@ -1668,7 +1668,7 @@ namespace Microsoft.Build.Evaluation /// private void RegisterLoggerInternal(ILogger logger) { - ErrorUtilities.VerifyThrowArgumentNull(logger, nameof(logger)); + ErrorUtilities.VerifyThrowArgumentNull(logger); Debug.Assert(_locker.IsWriteLockHeld); _loggingService.RegisterLogger(new ReusableLogger(logger)); } @@ -1942,7 +1942,7 @@ namespace Microsoft.Build.Evaluation /// public ReusableLogger(ILogger originalLogger) { - ErrorUtilities.VerifyThrowArgumentNull(originalLogger, nameof(originalLogger)); + ErrorUtilities.VerifyThrowArgumentNull(originalLogger); _originalLogger = originalLogger; } diff --git a/src/Build/Definition/ProjectImportPathMatch.cs b/src/Build/Definition/ProjectImportPathMatch.cs index 12667ea117..2eadd45fb4 100644 --- a/src/Build/Definition/ProjectImportPathMatch.cs +++ b/src/Build/Definition/ProjectImportPathMatch.cs @@ -29,8 +29,8 @@ namespace Microsoft.Build.Evaluation internal ProjectImportPathMatch(string propertyName, List searchPaths) { - ErrorUtilities.VerifyThrowArgumentNull(propertyName, nameof(propertyName)); - ErrorUtilities.VerifyThrowArgumentNull(searchPaths, nameof(searchPaths)); + ErrorUtilities.VerifyThrowArgumentNull(propertyName); + ErrorUtilities.VerifyThrowArgumentNull(searchPaths); _propertyName = propertyName; _searchPaths = searchPaths; diff --git a/src/Build/Definition/ProjectItem.cs b/src/Build/Definition/ProjectItem.cs index ddcf37f6b3..e203061b22 100644 --- a/src/Build/Definition/ProjectItem.cs +++ b/src/Build/Definition/ProjectItem.cs @@ -127,11 +127,11 @@ namespace Microsoft.Build.Evaluation List inheritedItemDefinitionsCloned) { ErrorUtilities.VerifyThrowInternalNull(project, nameof(project)); - ErrorUtilities.VerifyThrowArgumentNull(xml, nameof(xml)); + ErrorUtilities.VerifyThrowArgumentNull(xml); // Orcas accidentally allowed empty includes if they resulted from expansion: we preserve that bug - ErrorUtilities.VerifyThrowArgumentNull(evaluatedIncludeEscaped, nameof(evaluatedIncludeEscaped)); - ErrorUtilities.VerifyThrowArgumentNull(evaluatedIncludeBeforeWildcardExpansionEscaped, nameof(evaluatedIncludeBeforeWildcardExpansionEscaped)); + ErrorUtilities.VerifyThrowArgumentNull(evaluatedIncludeEscaped); + ErrorUtilities.VerifyThrowArgumentNull(evaluatedIncludeBeforeWildcardExpansionEscaped); _xml = xml; _project = project; diff --git a/src/Build/Definition/ProjectMetadata.cs b/src/Build/Definition/ProjectMetadata.cs index df770c85ce..d1cebcb95c 100644 --- a/src/Build/Definition/ProjectMetadata.cs +++ b/src/Build/Definition/ProjectMetadata.cs @@ -57,8 +57,8 @@ namespace Microsoft.Build.Evaluation /// internal ProjectMetadata(object parent, ProjectMetadataElement xml) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); - ErrorUtilities.VerifyThrowArgumentNull(xml, nameof(xml)); + ErrorUtilities.VerifyThrowArgumentNull(parent); + ErrorUtilities.VerifyThrowArgumentNull(xml); _parent = (IProjectMetadataParent)parent; _xml = xml; @@ -70,9 +70,9 @@ namespace Microsoft.Build.Evaluation /// internal ProjectMetadata(IProjectMetadataParent parent, ProjectMetadataElement xml, string evaluatedValueEscaped, ProjectMetadata predecessor) { - ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); - ErrorUtilities.VerifyThrowArgumentNull(xml, nameof(xml)); - ErrorUtilities.VerifyThrowArgumentNull(evaluatedValueEscaped, nameof(evaluatedValueEscaped)); + ErrorUtilities.VerifyThrowArgumentNull(parent); + ErrorUtilities.VerifyThrowArgumentNull(xml); + ErrorUtilities.VerifyThrowArgumentNull(evaluatedValueEscaped); _parent = parent; _xml = xml; diff --git a/src/Build/Definition/ProjectProperty.cs b/src/Build/Definition/ProjectProperty.cs index 43c7b7a382..a6789b65c4 100644 --- a/src/Build/Definition/ProjectProperty.cs +++ b/src/Build/Definition/ProjectProperty.cs @@ -40,7 +40,7 @@ namespace Microsoft.Build.Evaluation internal ProjectProperty(Project project) { - ErrorUtilities.VerifyThrowArgumentNull(project, nameof(project)); + ErrorUtilities.VerifyThrowArgumentNull(project); _project = project; } @@ -49,8 +49,8 @@ namespace Microsoft.Build.Evaluation /// internal ProjectProperty(Project project, string evaluatedValueEscaped) { - ErrorUtilities.VerifyThrowArgumentNull(project, nameof(project)); - ErrorUtilities.VerifyThrowArgumentNull(evaluatedValueEscaped, nameof(evaluatedValueEscaped)); + ErrorUtilities.VerifyThrowArgumentNull(project); + ErrorUtilities.VerifyThrowArgumentNull(evaluatedValueEscaped); _project = project; _evaluatedValueEscaped = evaluatedValueEscaped; @@ -359,7 +359,7 @@ namespace Microsoft.Build.Evaluation internal ProjectPropertyXmlBacked(Project project, ProjectPropertyElement xml, string evaluatedValueEscaped) : base(project, evaluatedValueEscaped) { - ErrorUtilities.VerifyThrowArgumentNull(xml, nameof(xml)); + ErrorUtilities.VerifyThrowArgumentNull(xml); ErrorUtilities.VerifyThrowInvalidOperation(!ProjectHasMatchingGlobalProperty(project, xml.Name), "OM_GlobalProperty", xml.Name); _xml = xml; @@ -504,7 +504,7 @@ namespace Microsoft.Build.Evaluation internal ProjectPropertyXmlBackedWithPredecessor(Project project, ProjectPropertyElement xml, string evaluatedValueEscaped, ProjectProperty predecessor) : base(project, xml, evaluatedValueEscaped) { - ErrorUtilities.VerifyThrowArgumentNull(predecessor, nameof(predecessor)); + ErrorUtilities.VerifyThrowArgumentNull(predecessor); _predecessor = predecessor; } diff --git a/src/Build/Definition/Toolset.cs b/src/Build/Definition/Toolset.cs index cd1c131706..c65e2093e5 100644 --- a/src/Build/Definition/Toolset.cs +++ b/src/Build/Definition/Toolset.cs @@ -272,8 +272,8 @@ namespace Microsoft.Build.Evaluation { ErrorUtilities.VerifyThrowArgumentLength(toolsVersion, nameof(toolsVersion)); ErrorUtilities.VerifyThrowArgumentLength(toolsPath, nameof(toolsPath)); - ErrorUtilities.VerifyThrowArgumentNull(environmentProperties, nameof(environmentProperties)); - ErrorUtilities.VerifyThrowArgumentNull(globalProperties, nameof(globalProperties)); + ErrorUtilities.VerifyThrowArgumentNull(environmentProperties); + ErrorUtilities.VerifyThrowArgumentNull(globalProperties); _toolsVersion = toolsVersion; this.ToolsPath = toolsPath; diff --git a/src/Build/Definition/ToolsetConfigurationReader.cs b/src/Build/Definition/ToolsetConfigurationReader.cs index f754cbf4d3..eb461785d0 100644 --- a/src/Build/Definition/ToolsetConfigurationReader.cs +++ b/src/Build/Definition/ToolsetConfigurationReader.cs @@ -69,7 +69,7 @@ namespace Microsoft.Build.Evaluation internal ToolsetConfigurationReader(PropertyDictionary environmentProperties, PropertyDictionary globalProperties, Func readApplicationConfiguration) : base(environmentProperties, globalProperties) { - ErrorUtilities.VerifyThrowArgumentNull(readApplicationConfiguration, nameof(readApplicationConfiguration)); + ErrorUtilities.VerifyThrowArgumentNull(readApplicationConfiguration); _readApplicationConfiguration = readApplicationConfiguration; _projectImportSearchPathsCache = new Dictionary>(StringComparer.OrdinalIgnoreCase); } diff --git a/src/Build/Definition/ToolsetPropertyDefinition.cs b/src/Build/Definition/ToolsetPropertyDefinition.cs index c7ee19a570..79deb3cafc 100644 --- a/src/Build/Definition/ToolsetPropertyDefinition.cs +++ b/src/Build/Definition/ToolsetPropertyDefinition.cs @@ -39,10 +39,10 @@ namespace Microsoft.Build.Evaluation public ToolsetPropertyDefinition(string name, string value, IElementLocation source) { ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); - ErrorUtilities.VerifyThrowArgumentNull(source, nameof(source)); + ErrorUtilities.VerifyThrowArgumentNull(source); // value can be the empty string but not null - ErrorUtilities.VerifyThrowArgumentNull(value, nameof(value)); + ErrorUtilities.VerifyThrowArgumentNull(value); _name = name; _value = value; diff --git a/src/Build/Errors/InvalidProjectFileException.cs b/src/Build/Errors/InvalidProjectFileException.cs index fe42d76e2f..19417da3f5 100644 --- a/src/Build/Errors/InvalidProjectFileException.cs +++ b/src/Build/Errors/InvalidProjectFileException.cs @@ -215,7 +215,7 @@ namespace Microsoft.Build.Exceptions string helpKeyword, Exception innerException) : base(message, innerException) { - ErrorUtilities.VerifyThrowArgumentNull(projectFile, nameof(projectFile)); + ErrorUtilities.VerifyThrowArgumentNull(projectFile); ErrorUtilities.VerifyThrowArgumentLength(message, nameof(message)); // Try to helpfully provide a full path if possible, but do so robustly. diff --git a/src/Build/Errors/InvalidToolsetDefinitionException.cs b/src/Build/Errors/InvalidToolsetDefinitionException.cs index df5b2a0979..8dbae22aa4 100644 --- a/src/Build/Errors/InvalidToolsetDefinitionException.cs +++ b/src/Build/Errors/InvalidToolsetDefinitionException.cs @@ -61,7 +61,7 @@ namespace Microsoft.Build.Exceptions protected InvalidToolsetDefinitionException(SerializationInfo info, StreamingContext context) : base(info, context) { - ErrorUtilities.VerifyThrowArgumentNull(info, nameof(info)); + ErrorUtilities.VerifyThrowArgumentNull(info); errorCode = info.GetString("errorCode"); } @@ -103,7 +103,7 @@ namespace Microsoft.Build.Exceptions #endif public override void GetObjectData(SerializationInfo info, StreamingContext context) { - ErrorUtilities.VerifyThrowArgumentNull(info, nameof(info)); + ErrorUtilities.VerifyThrowArgumentNull(info); base.GetObjectData(info, context); diff --git a/src/Build/Evaluation/ConditionEvaluator.cs b/src/Build/Evaluation/ConditionEvaluator.cs index f7918c1905..9bedc7a417 100644 --- a/src/Build/Evaluation/ConditionEvaluator.cs +++ b/src/Build/Evaluation/ConditionEvaluator.cs @@ -226,8 +226,8 @@ namespace Microsoft.Build.Evaluation where P : class, IProperty where I : class, IItem { - ErrorUtilities.VerifyThrowArgumentNull(condition, nameof(condition)); - ErrorUtilities.VerifyThrowArgumentNull(expander, nameof(expander)); + ErrorUtilities.VerifyThrowArgumentNull(condition); + ErrorUtilities.VerifyThrowArgumentNull(expander); ErrorUtilities.VerifyThrowArgumentLength(evaluationDirectory, nameof(evaluationDirectory)); // An empty condition is equivalent to a "true" condition. @@ -237,7 +237,7 @@ namespace Microsoft.Build.Evaluation } // If the condition wasn't empty, there must be a location for it - ErrorUtilities.VerifyThrowArgumentNull(elementLocation, nameof(elementLocation)); + ErrorUtilities.VerifyThrowArgumentNull(elementLocation); // Get the expression tree cache for the current parsing options. var cachedExpressionTreesForCurrentOptions = s_cachedExpressionTrees.GetOrAdd( @@ -427,10 +427,10 @@ namespace Microsoft.Build.Evaluation IFileSystem fileSystem, ProjectRootElementCacheBase? projectRootElementCache = null) { - ErrorUtilities.VerifyThrowArgumentNull(condition, nameof(condition)); - ErrorUtilities.VerifyThrowArgumentNull(expander, nameof(expander)); - ErrorUtilities.VerifyThrowArgumentNull(evaluationDirectory, nameof(evaluationDirectory)); - ErrorUtilities.VerifyThrowArgumentNull(elementLocation, nameof(elementLocation)); + ErrorUtilities.VerifyThrowArgumentNull(condition); + ErrorUtilities.VerifyThrowArgumentNull(expander); + ErrorUtilities.VerifyThrowArgumentNull(evaluationDirectory); + ErrorUtilities.VerifyThrowArgumentNull(elementLocation); Condition = condition; _expander = expander; diff --git a/src/Build/Evaluation/ProjectChangedEventArgs.cs b/src/Build/Evaluation/ProjectChangedEventArgs.cs index 22b38271a1..6d76eff382 100644 --- a/src/Build/Evaluation/ProjectChangedEventArgs.cs +++ b/src/Build/Evaluation/ProjectChangedEventArgs.cs @@ -19,7 +19,7 @@ namespace Microsoft.Build.Evaluation /// The changed project. internal ProjectChangedEventArgs(Project project) { - ErrorUtilities.VerifyThrowArgumentNull(project, nameof(project)); + ErrorUtilities.VerifyThrowArgumentNull(project); Project = project; } diff --git a/src/Build/Evaluation/ProjectRootElementCache.cs b/src/Build/Evaluation/ProjectRootElementCache.cs index 97c925a032..74a6ff5045 100644 --- a/src/Build/Evaluation/ProjectRootElementCache.cs +++ b/src/Build/Evaluation/ProjectRootElementCache.cs @@ -515,7 +515,7 @@ namespace Microsoft.Build.Evaluation /// internal override void DiscardAnyWeakReference(ProjectRootElement projectRootElement) { - ErrorUtilities.VerifyThrowArgumentNull(projectRootElement, nameof(projectRootElement)); + ErrorUtilities.VerifyThrowArgumentNull(projectRootElement); // A PRE may be unnamed if it was only used in memory. if (projectRootElement.FullPath != null) diff --git a/src/Build/Evaluation/ProjectXmlChangedEventArgs.cs b/src/Build/Evaluation/ProjectXmlChangedEventArgs.cs index 63b78917f2..c8a4a6351e 100644 --- a/src/Build/Evaluation/ProjectXmlChangedEventArgs.cs +++ b/src/Build/Evaluation/ProjectXmlChangedEventArgs.cs @@ -34,7 +34,7 @@ namespace Microsoft.Build.Evaluation /// The formatting parameter to use with . internal ProjectXmlChangedEventArgs(ProjectRootElement projectXml, string unformattedReason, string formattingParameter) { - ErrorUtilities.VerifyThrowArgumentNull(projectXml, nameof(projectXml)); + ErrorUtilities.VerifyThrowArgumentNull(projectXml); this.ProjectXml = projectXml; _unformattedReason = unformattedReason; diff --git a/src/Build/Evaluation/SimpleProjectRootElementCache.cs b/src/Build/Evaluation/SimpleProjectRootElementCache.cs index e2a9d7d782..b4e6b80b7b 100644 --- a/src/Build/Evaluation/SimpleProjectRootElementCache.cs +++ b/src/Build/Evaluation/SimpleProjectRootElementCache.cs @@ -121,7 +121,7 @@ namespace Microsoft.Build.Evaluation internal override void DiscardAnyWeakReference(ProjectRootElement projectRootElement) { - ErrorUtilities.VerifyThrowArgumentNull(projectRootElement, nameof(projectRootElement)); + ErrorUtilities.VerifyThrowArgumentNull(projectRootElement); // A PRE may be unnamed if it was only used in memory. if (projectRootElement.FullPath != null) diff --git a/src/Build/Globbing/CompositeGlob.cs b/src/Build/Globbing/CompositeGlob.cs index 546c590afd..b250180a5a 100644 --- a/src/Build/Globbing/CompositeGlob.cs +++ b/src/Build/Globbing/CompositeGlob.cs @@ -85,7 +85,7 @@ namespace Microsoft.Build.Globbing /// The logical disjunction of the input globs. public static IMSBuildGlob Create(IEnumerable globs) { - ErrorUtilities.VerifyThrowArgumentNull(globs, nameof(globs)); + ErrorUtilities.VerifyThrowArgumentNull(globs); if (globs is ImmutableArray immutableGlobs) { diff --git a/src/Build/Globbing/MSBuildGlob.cs b/src/Build/Globbing/MSBuildGlob.cs index 44fb19d4ab..e6cb8ab1ac 100644 --- a/src/Build/Globbing/MSBuildGlob.cs +++ b/src/Build/Globbing/MSBuildGlob.cs @@ -91,7 +91,7 @@ namespace Microsoft.Build.Globbing /// public bool IsMatch(string stringToMatch) { - ErrorUtilities.VerifyThrowArgumentNull(stringToMatch, nameof(stringToMatch)); + ErrorUtilities.VerifyThrowArgumentNull(stringToMatch); if (!IsLegal) { @@ -115,7 +115,7 @@ namespace Microsoft.Build.Globbing /// public MatchInfoResult MatchInfo(string stringToMatch) { - ErrorUtilities.VerifyThrowArgumentNull(stringToMatch, nameof(stringToMatch)); + ErrorUtilities.VerifyThrowArgumentNull(stringToMatch); if (FileUtilities.PathIsInvalid(stringToMatch) || !IsLegal) { @@ -168,8 +168,8 @@ namespace Microsoft.Build.Globbing /// public static MSBuildGlob Parse(string globRoot, string fileSpec) { - ErrorUtilities.VerifyThrowArgumentNull(globRoot, nameof(globRoot)); - ErrorUtilities.VerifyThrowArgumentNull(fileSpec, nameof(fileSpec)); + ErrorUtilities.VerifyThrowArgumentNull(globRoot); + ErrorUtilities.VerifyThrowArgumentNull(fileSpec); ErrorUtilities.VerifyThrowArgumentInvalidPath(globRoot, nameof(globRoot)); if (string.IsNullOrEmpty(globRoot)) diff --git a/src/Build/Globbing/MSBuildGlobWithGaps.cs b/src/Build/Globbing/MSBuildGlobWithGaps.cs index 442000b8a4..d8008496f4 100644 --- a/src/Build/Globbing/MSBuildGlobWithGaps.cs +++ b/src/Build/Globbing/MSBuildGlobWithGaps.cs @@ -41,8 +41,8 @@ namespace Microsoft.Build.Globbing /// The gap glob internal MSBuildGlobWithGaps(IMSBuildGlob mainGlob, IMSBuildGlob gaps) { - ErrorUtilities.VerifyThrowArgumentNull(mainGlob, nameof(mainGlob)); - ErrorUtilities.VerifyThrowArgumentNull(gaps, nameof(gaps)); + ErrorUtilities.VerifyThrowArgumentNull(mainGlob); + ErrorUtilities.VerifyThrowArgumentNull(gaps); MainGlob = mainGlob; Gaps = gaps; @@ -55,8 +55,8 @@ namespace Microsoft.Build.Globbing /// The gap glob public MSBuildGlobWithGaps(IMSBuildGlob mainGlob, IEnumerable gaps) { - ErrorUtilities.VerifyThrowArgumentNull(mainGlob, nameof(mainGlob)); - ErrorUtilities.VerifyThrowArgumentNull(gaps, nameof(gaps)); + ErrorUtilities.VerifyThrowArgumentNull(mainGlob); + ErrorUtilities.VerifyThrowArgumentNull(gaps); MainGlob = mainGlob; Gaps = CompositeGlob.Create(gaps); diff --git a/src/Build/Graph/GraphBuildRequestData.cs b/src/Build/Graph/GraphBuildRequestData.cs index 31e8cae7c7..4d95ec0afe 100644 --- a/src/Build/Graph/GraphBuildRequestData.cs +++ b/src/Build/Graph/GraphBuildRequestData.cs @@ -55,7 +55,7 @@ namespace Microsoft.Build.Graph public GraphBuildRequestData(ProjectGraph projectGraph, ICollection targetsToBuild, HostServices? hostServices, BuildRequestDataFlags flags) : this(targetsToBuild, hostServices, flags) { - ErrorUtilities.VerifyThrowArgumentNull(projectGraph, nameof(projectGraph)); + ErrorUtilities.VerifyThrowArgumentNull(projectGraph); ProjectGraph = projectGraph; } @@ -149,7 +149,7 @@ namespace Microsoft.Build.Graph public GraphBuildRequestData(IEnumerable projectGraphEntryPoints, ICollection targetsToBuild, HostServices? hostServices, BuildRequestDataFlags flags) : this(targetsToBuild, hostServices, flags) { - ErrorUtilities.VerifyThrowArgumentNull(projectGraphEntryPoints, nameof(projectGraphEntryPoints)); + ErrorUtilities.VerifyThrowArgumentNull(projectGraphEntryPoints); ProjectGraphEntryPoints = projectGraphEntryPoints; } @@ -157,7 +157,7 @@ namespace Microsoft.Build.Graph public GraphBuildRequestData(IEnumerable projectGraphEntryPoints, ICollection targetsToBuild, HostServices? hostServices, BuildRequestDataFlags flags, GraphBuildOptions graphBuildOptions) : this(targetsToBuild, hostServices, flags, graphBuildOptions) { - ErrorUtilities.VerifyThrowArgumentNull(projectGraphEntryPoints, nameof(projectGraphEntryPoints)); + ErrorUtilities.VerifyThrowArgumentNull(projectGraphEntryPoints); ProjectGraphEntryPoints = projectGraphEntryPoints.ToList(); } diff --git a/src/Build/Graph/ProjectGraph.cs b/src/Build/Graph/ProjectGraph.cs index 4df1c7e3ea..e3c7dcc048 100644 --- a/src/Build/Graph/ProjectGraph.cs +++ b/src/Build/Graph/ProjectGraph.cs @@ -421,7 +421,7 @@ namespace Microsoft.Build.Graph int degreeOfParallelism, CancellationToken cancellationToken) { - ErrorUtilities.VerifyThrowArgumentNull(projectCollection, nameof(projectCollection)); + ErrorUtilities.VerifyThrowArgumentNull(projectCollection); var measurementInfo = BeginMeasurement(); @@ -498,7 +498,7 @@ namespace Microsoft.Build.Graph Func nodeIdProvider, IReadOnlyDictionary> targetsPerNode = null) { - ErrorUtilities.VerifyThrowArgumentNull(nodeIdProvider, nameof(nodeIdProvider)); + ErrorUtilities.VerifyThrowArgumentNull(nodeIdProvider); var nodeIds = new ConcurrentDictionary(); diff --git a/src/Build/Graph/ProjectInterpretation.cs b/src/Build/Graph/ProjectInterpretation.cs index e1173e4668..8f12832af4 100644 --- a/src/Build/Graph/ProjectInterpretation.cs +++ b/src/Build/Graph/ProjectInterpretation.cs @@ -383,7 +383,7 @@ namespace Microsoft.Build.Graph IEnumerable globalPropertyModifiers) { ErrorUtilities.VerifyThrowInternalNull(projectReference, nameof(projectReference)); - ErrorUtilities.VerifyThrowArgumentNull(requesterGlobalProperties, nameof(requesterGlobalProperties)); + ErrorUtilities.VerifyThrowArgumentNull(requesterGlobalProperties); var properties = SplitPropertyNameValuePairs(ItemMetadataNames.PropertiesMetadataName, projectReference.GetMetadataValue(ItemMetadataNames.PropertiesMetadataName)); var additionalProperties = SplitPropertyNameValuePairs(ItemMetadataNames.AdditionalPropertiesMetadataName, projectReference.GetMetadataValue(ItemMetadataNames.AdditionalPropertiesMetadataName)); diff --git a/src/Build/Instance/HostServices.cs b/src/Build/Instance/HostServices.cs index 2154606e62..4028cb9524 100644 --- a/src/Build/Instance/HostServices.cs +++ b/src/Build/Instance/HostServices.cs @@ -66,9 +66,9 @@ namespace Microsoft.Build.Execution /// public ITaskHost GetHostObject(string projectFile, string targetName, string taskName) { - ErrorUtilities.VerifyThrowArgumentNull(projectFile, nameof(projectFile)); - ErrorUtilities.VerifyThrowArgumentNull(targetName, nameof(targetName)); - ErrorUtilities.VerifyThrowArgumentNull(taskName, nameof(taskName)); + ErrorUtilities.VerifyThrowArgumentNull(projectFile); + ErrorUtilities.VerifyThrowArgumentNull(targetName); + ErrorUtilities.VerifyThrowArgumentNull(taskName); HostObjects hostObjects; if (_hostObjectMap == null || !_hostObjectMap.TryGetValue(projectFile, out hostObjects)) @@ -131,9 +131,9 @@ namespace Microsoft.Build.Execution ErrorUtilities.VerifyThrowArgumentNull(projectFile, "projectFile)); ErrorUtilities.VerifyThrowArgumentNull(targetName, "targetName)); */ - ErrorUtilities.VerifyThrowArgumentNull(projectFile, nameof(projectFile)); - ErrorUtilities.VerifyThrowArgumentNull(targetName, nameof(targetName)); - ErrorUtilities.VerifyThrowArgumentNull(taskName, nameof(taskName)); + ErrorUtilities.VerifyThrowArgumentNull(projectFile); + ErrorUtilities.VerifyThrowArgumentNull(targetName); + ErrorUtilities.VerifyThrowArgumentNull(taskName); // We can only set the host object to a non-null value if the affinity for the project is not out of proc, or if it is, it is only implicitly // out of proc, in which case it will become in-proc after this call completes. See GetNodeAffinity. @@ -164,10 +164,10 @@ namespace Microsoft.Build.Execution [SupportedOSPlatform("windows")] public void RegisterHostObject(string projectFile, string targetName, string taskName, string monikerName) { - ErrorUtilities.VerifyThrowArgumentNull(projectFile, nameof(projectFile)); - ErrorUtilities.VerifyThrowArgumentNull(targetName, nameof(targetName)); - ErrorUtilities.VerifyThrowArgumentNull(taskName, nameof(taskName)); - ErrorUtilities.VerifyThrowArgumentNull(monikerName, nameof(monikerName)); + ErrorUtilities.VerifyThrowArgumentNull(projectFile); + ErrorUtilities.VerifyThrowArgumentNull(targetName); + ErrorUtilities.VerifyThrowArgumentNull(taskName); + ErrorUtilities.VerifyThrowArgumentNull(monikerName); _hostObjectMap ??= new Dictionary(StringComparer.OrdinalIgnoreCase); diff --git a/src/Build/Instance/ImmutableProjectCollections/ImmutableItemDefinitionsListConverter.cs b/src/Build/Instance/ImmutableProjectCollections/ImmutableItemDefinitionsListConverter.cs index 1a1d499b0a..245d42583b 100644 --- a/src/Build/Instance/ImmutableProjectCollections/ImmutableItemDefinitionsListConverter.cs +++ b/src/Build/Instance/ImmutableProjectCollections/ImmutableItemDefinitionsListConverter.cs @@ -25,7 +25,7 @@ namespace Microsoft.Build.Instance TCached? itemTypeDefinition, Func getInstance) { - ErrorUtilities.VerifyThrowArgumentNull(getInstance, nameof(getInstance)); + ErrorUtilities.VerifyThrowArgumentNull(getInstance); _itemList = itemList; _itemTypeDefinition = itemTypeDefinition; diff --git a/src/Build/Instance/ProjectInstance.cs b/src/Build/Instance/ProjectInstance.cs index 1419a53c6d..cd0b402749 100644 --- a/src/Build/Instance/ProjectInstance.cs +++ b/src/Build/Instance/ProjectInstance.cs @@ -614,7 +614,7 @@ namespace Microsoft.Build.Execution { ErrorUtilities.VerifyThrowArgumentLength(projectFile, nameof(projectFile)); ErrorUtilities.VerifyThrowArgumentLengthIfNotNull(toolsVersion, nameof(toolsVersion)); - ErrorUtilities.VerifyThrowArgumentNull(buildParameters, nameof(buildParameters)); + ErrorUtilities.VerifyThrowArgumentNull(buildParameters); ProjectRootElement xml = ProjectRootElement.OpenProjectOrSolution(projectFile, globalProperties, toolsVersion, buildParameters.ProjectRootElementCache, false /*Not explicitly loaded*/); @@ -628,9 +628,9 @@ namespace Microsoft.Build.Execution /// internal ProjectInstance(ProjectRootElement xml, IDictionary globalProperties, string toolsVersion, BuildParameters buildParameters, ILoggingService loggingService, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, int submissionId) { - ErrorUtilities.VerifyThrowArgumentNull(xml, nameof(xml)); + ErrorUtilities.VerifyThrowArgumentNull(xml); ErrorUtilities.VerifyThrowArgumentLengthIfNotNull(toolsVersion, nameof(toolsVersion)); - ErrorUtilities.VerifyThrowArgumentNull(buildParameters, nameof(buildParameters)); + ErrorUtilities.VerifyThrowArgumentNull(buildParameters); Initialize(xml, globalProperties, toolsVersion, null, 0 /* no solution version specified */, buildParameters, loggingService, buildEventContext, sdkResolverService, submissionId); } @@ -1609,7 +1609,7 @@ namespace Microsoft.Build.Execution [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters", Justification = "IItem is an internal interface; this is less confusing to outside customers. ")] public static string GetEvaluatedItemIncludeEscaped(ProjectItemInstance item) { - ErrorUtilities.VerifyThrowArgumentNull(item, nameof(item)); + ErrorUtilities.VerifyThrowArgumentNull(item); return ((IItem)item).EvaluatedIncludeEscaped; } @@ -1619,7 +1619,7 @@ namespace Microsoft.Build.Execution /// public static string GetEvaluatedItemIncludeEscaped(ProjectItemDefinitionInstance item) { - ErrorUtilities.VerifyThrowArgumentNull(item, nameof(item)); + ErrorUtilities.VerifyThrowArgumentNull(item); return ((IItem)item).EvaluatedIncludeEscaped; } @@ -1629,7 +1629,7 @@ namespace Microsoft.Build.Execution /// public static string GetMetadataValueEscaped(ProjectMetadataInstance metadatum) { - ErrorUtilities.VerifyThrowArgumentNull(metadatum, nameof(metadatum)); + ErrorUtilities.VerifyThrowArgumentNull(metadatum); return metadatum.EvaluatedValueEscaped; } @@ -1640,7 +1640,7 @@ namespace Microsoft.Build.Execution [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters", Justification = "IItem is an internal interface; this is less confusing to outside customers. ")] public static string GetMetadataValueEscaped(ProjectItemInstance item, string name) { - ErrorUtilities.VerifyThrowArgumentNull(item, nameof(item)); + ErrorUtilities.VerifyThrowArgumentNull(item); return ((IItem)item).GetMetadataValueEscaped(name); } @@ -1650,7 +1650,7 @@ namespace Microsoft.Build.Execution /// public static string GetMetadataValueEscaped(ProjectItemDefinitionInstance item, string name) { - ErrorUtilities.VerifyThrowArgumentNull(item, nameof(item)); + ErrorUtilities.VerifyThrowArgumentNull(item); return ((IItem)item).GetMetadataValueEscaped(name); } @@ -1661,7 +1661,7 @@ namespace Microsoft.Build.Execution [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters", Justification = "IProperty is an internal interface; this is less confusing to outside customers. ")] public static string GetPropertyValueEscaped(ProjectPropertyInstance property) { - ErrorUtilities.VerifyThrowArgumentNull(property, nameof(property)); + ErrorUtilities.VerifyThrowArgumentNull(property); return ((IProperty)property).EvaluatedValueEscaped; } @@ -2538,9 +2538,9 @@ namespace Microsoft.Build.Execution int submissionId) { ErrorUtilities.VerifyThrowArgumentLength(projectFile, nameof(projectFile)); - ErrorUtilities.VerifyThrowArgumentNull(globalPropertiesInstances, nameof(globalPropertiesInstances)); + ErrorUtilities.VerifyThrowArgumentNull(globalPropertiesInstances); ErrorUtilities.VerifyThrowArgumentLengthIfNotNull(toolsVersion, nameof(toolsVersion)); - ErrorUtilities.VerifyThrowArgumentNull(buildParameters, nameof(buildParameters)); + ErrorUtilities.VerifyThrowArgumentNull(buildParameters); ErrorUtilities.VerifyThrow(FileUtilities.IsSolutionFilename(projectFile), "Project file {0} is not a solution.", projectFile); ProjectInstance[] projectInstances = null; @@ -3044,9 +3044,9 @@ namespace Microsoft.Build.Execution EvaluationContext evaluationContext = null, IDirectoryCacheFactory directoryCacheFactory = null) { - ErrorUtilities.VerifyThrowArgumentNull(xml, nameof(xml)); + ErrorUtilities.VerifyThrowArgumentNull(xml); ErrorUtilities.VerifyThrowArgumentLengthIfNotNull(explicitToolsVersion, "toolsVersion"); - ErrorUtilities.VerifyThrowArgumentNull(buildParameters, nameof(buildParameters)); + ErrorUtilities.VerifyThrowArgumentNull(buildParameters); _directory = xml.DirectoryPath; _projectFileLocation = xml.ProjectFileLocation ?? ElementLocation.EmptyLocation; diff --git a/src/Build/Instance/ProjectItemDefinitionInstance.cs b/src/Build/Instance/ProjectItemDefinitionInstance.cs index d1d7ac3c67..4e886bd134 100644 --- a/src/Build/Instance/ProjectItemDefinitionInstance.cs +++ b/src/Build/Instance/ProjectItemDefinitionInstance.cs @@ -41,7 +41,7 @@ namespace Microsoft.Build.Execution /// The type of item this definition object represents. internal ProjectItemDefinitionInstance(string itemType) { - ErrorUtilities.VerifyThrowArgumentNull(itemType, nameof(itemType)); + ErrorUtilities.VerifyThrowArgumentNull(itemType); _itemType = itemType; } diff --git a/src/Build/Instance/ProjectItemInstance.cs b/src/Build/Instance/ProjectItemInstance.cs index ec5c67f344..c713c86ac0 100644 --- a/src/Build/Instance/ProjectItemInstance.cs +++ b/src/Build/Instance/ProjectItemInstance.cs @@ -1406,7 +1406,7 @@ namespace Microsoft.Build.Execution /// public void CopyMetadataTo(ITaskItem destinationItem, bool addOriginalItemSpec) { - ErrorUtilities.VerifyThrowArgumentNull(destinationItem, nameof(destinationItem)); + ErrorUtilities.VerifyThrowArgumentNull(destinationItem); string originalItemSpec = null; if (addOriginalItemSpec) diff --git a/src/Build/Instance/ProjectPropertyInstance.cs b/src/Build/Instance/ProjectPropertyInstance.cs index 13b3c07695..dc7cb2b662 100644 --- a/src/Build/Instance/ProjectPropertyInstance.cs +++ b/src/Build/Instance/ProjectPropertyInstance.cs @@ -74,7 +74,7 @@ namespace Microsoft.Build.Execution set { ProjectInstance.VerifyThrowNotImmutable(IsImmutable); - ErrorUtilities.VerifyThrowArgumentNull(value, nameof(value)); + ErrorUtilities.VerifyThrowArgumentNull(value); _escapedValue = EscapingUtilities.Escape(value); } } @@ -322,7 +322,7 @@ namespace Microsoft.Build.Execution private static ProjectPropertyInstance Create(string name, string escapedValue, bool mayBeReserved, ElementLocation location, bool isImmutable, bool isEnvironmentProperty = false, LoggingContext loggingContext = null) { // Does not check immutability as this is only called during build (which is already protected) or evaluation - ErrorUtilities.VerifyThrowArgumentNull(escapedValue, nameof(escapedValue)); + ErrorUtilities.VerifyThrowArgumentNull(escapedValue); if (location == null) { ErrorUtilities.VerifyThrowArgument(!XMakeElements.ReservedItemNames.Contains(name), "OM_ReservedName", name); diff --git a/src/Build/Instance/ProjectTaskInstance.cs b/src/Build/Instance/ProjectTaskInstance.cs index 1e066edcda..8371334724 100644 --- a/src/Build/Instance/ProjectTaskInstance.cs +++ b/src/Build/Instance/ProjectTaskInstance.cs @@ -162,8 +162,8 @@ namespace Microsoft.Build.Execution ElementLocation msbuildArchitectureLocation) { ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name)); - ErrorUtilities.VerifyThrowArgumentNull(condition, nameof(condition)); - ErrorUtilities.VerifyThrowArgumentNull(continueOnError, nameof(continueOnError)); + ErrorUtilities.VerifyThrowArgumentNull(condition); + ErrorUtilities.VerifyThrowArgumentNull(continueOnError); _name = name; _condition = condition; diff --git a/src/Build/Instance/ReflectableTaskPropertyInfo.cs b/src/Build/Instance/ReflectableTaskPropertyInfo.cs index bc23ef3430..0ec83c8c57 100644 --- a/src/Build/Instance/ReflectableTaskPropertyInfo.cs +++ b/src/Build/Instance/ReflectableTaskPropertyInfo.cs @@ -34,7 +34,7 @@ namespace Microsoft.Build.Execution internal ReflectableTaskPropertyInfo(TaskPropertyInfo taskPropertyInfo, Type taskType) : base(taskPropertyInfo.Name, taskPropertyInfo.PropertyType, taskPropertyInfo.Output, taskPropertyInfo.Required) { - ErrorUtilities.VerifyThrowArgumentNull(taskType, nameof(taskType)); + ErrorUtilities.VerifyThrowArgumentNull(taskType); _taskType = taskType; } diff --git a/src/Build/Instance/TaskFactories/AssemblyTaskFactory.cs b/src/Build/Instance/TaskFactories/AssemblyTaskFactory.cs index a830764d05..f277795e40 100644 --- a/src/Build/Instance/TaskFactories/AssemblyTaskFactory.cs +++ b/src/Build/Instance/TaskFactories/AssemblyTaskFactory.cs @@ -202,7 +202,7 @@ namespace Microsoft.Build.BackEnd /// public void CleanupTask(ITask task) { - ErrorUtilities.VerifyThrowArgumentNull(task, nameof(task)); + ErrorUtilities.VerifyThrowArgumentNull(task); #if FEATURE_APPDOMAIN AppDomain appDomain; if (_tasksAndAppDomains.TryGetValue(task, out appDomain)) @@ -257,7 +257,7 @@ namespace Microsoft.Build.BackEnd ElementLocation elementLocation, string taskProjectFile) { - ErrorUtilities.VerifyThrowArgumentNull(loadInfo, nameof(loadInfo)); + ErrorUtilities.VerifyThrowArgumentNull(loadInfo); VerifyThrowIdentityParametersValid(taskFactoryIdentityParameters, elementLocation, taskName, "Runtime", "Architecture"); if (taskFactoryIdentityParameters != null) diff --git a/src/Build/Instance/TaskFactoryLoggingHost.cs b/src/Build/Instance/TaskFactoryLoggingHost.cs index c8e70102bd..05cbd286eb 100644 --- a/src/Build/Instance/TaskFactoryLoggingHost.cs +++ b/src/Build/Instance/TaskFactoryLoggingHost.cs @@ -60,7 +60,7 @@ namespace Microsoft.Build.BackEnd /// public TaskFactoryLoggingHost(bool isRunningWithMultipleNodes, ElementLocation elementLocation, BuildLoggingContext loggingContext) { - ErrorUtilities.VerifyThrowArgumentNull(loggingContext, nameof(loggingContext)); + ErrorUtilities.VerifyThrowArgumentNull(loggingContext); ErrorUtilities.VerifyThrowInternalNull(elementLocation, nameof(elementLocation)); _activeProxy = true; @@ -154,7 +154,7 @@ namespace Microsoft.Build.BackEnd /// The event args public void LogErrorEvent(Microsoft.Build.Framework.BuildErrorEventArgs e) { - ErrorUtilities.VerifyThrowArgumentNull(e, nameof(e)); + ErrorUtilities.VerifyThrowArgumentNull(e); VerifyActiveProxy(); // If we are in building across process we need the events to be serializable. This method will @@ -175,7 +175,7 @@ namespace Microsoft.Build.BackEnd /// The event args public void LogWarningEvent(Microsoft.Build.Framework.BuildWarningEventArgs e) { - ErrorUtilities.VerifyThrowArgumentNull(e, nameof(e)); + ErrorUtilities.VerifyThrowArgumentNull(e); VerifyActiveProxy(); // If we are in building across process we need the events to be serializable. This method will @@ -196,7 +196,7 @@ namespace Microsoft.Build.BackEnd /// The event args public void LogMessageEvent(Microsoft.Build.Framework.BuildMessageEventArgs e) { - ErrorUtilities.VerifyThrowArgumentNull(e, nameof(e)); + ErrorUtilities.VerifyThrowArgumentNull(e); VerifyActiveProxy(); // If we are in building across process we need the events to be serializable. This method will @@ -217,7 +217,7 @@ namespace Microsoft.Build.BackEnd /// The event args public void LogCustomEvent(Microsoft.Build.Framework.CustomBuildEventArgs e) { - ErrorUtilities.VerifyThrowArgumentNull(e, nameof(e)); + ErrorUtilities.VerifyThrowArgumentNull(e); VerifyActiveProxy(); // If we are in building across process we need the events to be serializable. This method will diff --git a/src/Build/Instance/TaskFactoryWrapper.cs b/src/Build/Instance/TaskFactoryWrapper.cs index 6a6f117d12..0254323dee 100644 --- a/src/Build/Instance/TaskFactoryWrapper.cs +++ b/src/Build/Instance/TaskFactoryWrapper.cs @@ -82,7 +82,7 @@ namespace Microsoft.Build.Execution /// internal TaskFactoryWrapper(ITaskFactory taskFactory, LoadedType taskFactoryLoadInfo, string taskName, IDictionary factoryIdentityParameters) { - ErrorUtilities.VerifyThrowArgumentNull(taskFactory, nameof(taskFactory)); + ErrorUtilities.VerifyThrowArgumentNull(taskFactory); ErrorUtilities.VerifyThrowArgumentLength(taskName, nameof(taskName)); _taskFactory = taskFactory; _taskName = taskName; @@ -197,8 +197,8 @@ namespace Microsoft.Build.Execution /// internal void SetPropertyValue(ITask task, TaskPropertyInfo property, object value) { - ErrorUtilities.VerifyThrowArgumentNull(task, nameof(task)); - ErrorUtilities.VerifyThrowArgumentNull(property, nameof(property)); + ErrorUtilities.VerifyThrowArgumentNull(task); + ErrorUtilities.VerifyThrowArgumentNull(property); IGeneratedTask? generatedTask = task as IGeneratedTask; if (generatedTask != null) @@ -217,8 +217,8 @@ namespace Microsoft.Build.Execution /// internal object? GetPropertyValue(ITask task, TaskPropertyInfo property) { - ErrorUtilities.VerifyThrowArgumentNull(task, nameof(task)); - ErrorUtilities.VerifyThrowArgumentNull(property, nameof(property)); + ErrorUtilities.VerifyThrowArgumentNull(task); + ErrorUtilities.VerifyThrowArgumentNull(property); IGeneratedTask? generatedTask = task as IGeneratedTask; if (generatedTask != null) diff --git a/src/Build/Instance/TaskRegistry.cs b/src/Build/Instance/TaskRegistry.cs index 3618f4c1b1..53a34fca3f 100644 --- a/src/Build/Instance/TaskRegistry.cs +++ b/src/Build/Instance/TaskRegistry.cs @@ -1613,8 +1613,8 @@ namespace Microsoft.Build.Execution where P : class, IProperty where I : class, IItem { - ErrorUtilities.VerifyThrowArgumentNull(projectUsingTaskXml, nameof(projectUsingTaskXml)); - ErrorUtilities.VerifyThrowArgumentNull(expander, nameof(expander)); + ErrorUtilities.VerifyThrowArgumentNull(projectUsingTaskXml); + ErrorUtilities.VerifyThrowArgumentNull(expander); ProjectUsingTaskBodyElement taskElement = projectUsingTaskXml.TaskBody; if (taskElement != null) diff --git a/src/Build/Logging/BaseConsoleLogger.cs b/src/Build/Logging/BaseConsoleLogger.cs index d254e53458..508223e628 100644 --- a/src/Build/Logging/BaseConsoleLogger.cs +++ b/src/Build/Logging/BaseConsoleLogger.cs @@ -964,7 +964,7 @@ namespace Microsoft.Build.BackEnd.Logging /// internal virtual bool ApplyParameter(string parameterName, string parameterValue) { - ErrorUtilities.VerifyThrowArgumentNull(parameterName, nameof(parameterName)); + ErrorUtilities.VerifyThrowArgumentNull(parameterName); switch (parameterName.ToUpperInvariant()) { diff --git a/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs b/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs index 55cc7fd8c5..072d2013ac 100644 --- a/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs +++ b/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs @@ -105,7 +105,7 @@ namespace Microsoft.Build.Logging /// private void ApplyParameter(IEventSource eventSource, string parameterName) { - ErrorUtilities.VerifyThrowArgumentNull(parameterName, nameof(parameterName)); + ErrorUtilities.VerifyThrowArgumentNull(parameterName); bool isEventForwardingParameter = true; @@ -202,7 +202,7 @@ namespace Microsoft.Build.Logging /// public virtual void Initialize(IEventSource eventSource) { - ErrorUtilities.VerifyThrowArgumentNull(eventSource, nameof(eventSource)); + ErrorUtilities.VerifyThrowArgumentNull(eventSource); ParseParameters(eventSource); diff --git a/src/Build/Logging/DistributedLoggers/DistributedFileLogger.cs b/src/Build/Logging/DistributedLoggers/DistributedFileLogger.cs index 67b1d939f9..591df6df9f 100644 --- a/src/Build/Logging/DistributedLoggers/DistributedFileLogger.cs +++ b/src/Build/Logging/DistributedLoggers/DistributedFileLogger.cs @@ -94,7 +94,7 @@ namespace Microsoft.Build.Logging /// public void Initialize(IEventSource eventSource) { - ErrorUtilities.VerifyThrowArgumentNull(eventSource, nameof(eventSource)); + ErrorUtilities.VerifyThrowArgumentNull(eventSource); ParseFileLoggerParameters(); string fileName = _logFile; diff --git a/src/Build/Logging/FileLogger.cs b/src/Build/Logging/FileLogger.cs index f325ea36d2..b87504c5a5 100644 --- a/src/Build/Logging/FileLogger.cs +++ b/src/Build/Logging/FileLogger.cs @@ -56,7 +56,7 @@ namespace Microsoft.Build.Logging /// Available events. public override void Initialize(IEventSource eventSource) { - ErrorUtilities.VerifyThrowArgumentNull(eventSource, nameof(eventSource)); + ErrorUtilities.VerifyThrowArgumentNull(eventSource); eventSource.BuildFinished += FileLoggerBuildFinished; InitializeFileLogger(eventSource, 1); } diff --git a/src/Build/Utilities/RegistryKeyWrapper.cs b/src/Build/Utilities/RegistryKeyWrapper.cs index e946a3546a..2ceedb272c 100644 --- a/src/Build/Utilities/RegistryKeyWrapper.cs +++ b/src/Build/Utilities/RegistryKeyWrapper.cs @@ -66,8 +66,8 @@ namespace Microsoft.Build.Internal /// internal RegistryKeyWrapper(string registryKeyPath, RegistryKey registryHive) { - ErrorUtilities.VerifyThrowArgumentNull(registryKeyPath, nameof(registryKeyPath)); - ErrorUtilities.VerifyThrowArgumentNull(registryHive, nameof(registryHive)); + ErrorUtilities.VerifyThrowArgumentNull(registryKeyPath); + ErrorUtilities.VerifyThrowArgumentNull(registryHive); _registryKeyPath = registryKeyPath; _registryHive = registryHive; diff --git a/src/MSBuild/CommandLineSwitchException.cs b/src/MSBuild/CommandLineSwitchException.cs index 364fce6da5..fdfd2b3676 100644 --- a/src/MSBuild/CommandLineSwitchException.cs +++ b/src/MSBuild/CommandLineSwitchException.cs @@ -54,7 +54,7 @@ namespace Microsoft.Build.CommandLine StreamingContext context) : base(info, context) { - ErrorUtilities.VerifyThrowArgumentNull(info, nameof(info)); + ErrorUtilities.VerifyThrowArgumentNull(info); commandLineArg = info.GetString("commandLineArg"); } diff --git a/src/MSBuild/InitializationException.cs b/src/MSBuild/InitializationException.cs index fea748158a..4607ec549a 100644 --- a/src/MSBuild/InitializationException.cs +++ b/src/MSBuild/InitializationException.cs @@ -59,7 +59,7 @@ namespace Microsoft.Build.CommandLine StreamingContext context) : base(info, context) { - ErrorUtilities.VerifyThrowArgumentNull(info, nameof(info)); + ErrorUtilities.VerifyThrowArgumentNull(info); invalidSwitch = info.GetString("invalidSwitch"); } diff --git a/src/MSBuild/ProjectSchemaValidationHandler.cs b/src/MSBuild/ProjectSchemaValidationHandler.cs index 73986e71b2..474a0c0984 100644 --- a/src/MSBuild/ProjectSchemaValidationHandler.cs +++ b/src/MSBuild/ProjectSchemaValidationHandler.cs @@ -38,8 +38,8 @@ namespace Microsoft.Build.CommandLine string schemaFile, string binPath) { - ErrorUtilities.VerifyThrowArgumentNull(projectFile, nameof(projectFile)); - ErrorUtilities.VerifyThrowArgumentNull(binPath, nameof(binPath)); + ErrorUtilities.VerifyThrowArgumentNull(projectFile); + ErrorUtilities.VerifyThrowArgumentNull(binPath); if (string.IsNullOrEmpty(schemaFile)) { @@ -72,8 +72,8 @@ namespace Microsoft.Build.CommandLine string projectFile, string schemaFile) { - ErrorUtilities.VerifyThrowArgumentNull(schemaFile, nameof(schemaFile)); - ErrorUtilities.VerifyThrowArgumentNull(projectFile, nameof(projectFile)); + ErrorUtilities.VerifyThrowArgumentNull(schemaFile); + ErrorUtilities.VerifyThrowArgumentNull(projectFile); // Options for XmlReader object can be set only in constructor. After the object is created, they // become read-only. Because of that we need to create diff --git a/src/MSBuild/TerminalLogger/TerminalLogger.cs b/src/MSBuild/TerminalLogger/TerminalLogger.cs index 038ec536f6..85a4baf1e0 100644 --- a/src/MSBuild/TerminalLogger/TerminalLogger.cs +++ b/src/MSBuild/TerminalLogger/TerminalLogger.cs @@ -217,7 +217,7 @@ internal sealed partial class TerminalLogger : INodeLogger private bool _hasUsedCache = false; /// - /// Whether to show TaskCommandLineEventArgs high-priority messages. + /// Whether to show TaskCommandLineEventArgs high-priority messages. /// private bool _showCommandLine = false; @@ -309,7 +309,7 @@ internal sealed partial class TerminalLogger : INodeLogger /// private void ApplyParameter(string parameterName, string? parameterValue) { - ErrorUtilities.VerifyThrowArgumentNull(parameterName, nameof(parameterName)); + ErrorUtilities.VerifyThrowArgumentNull(parameterName); switch (parameterName.ToUpperInvariant()) { diff --git a/src/MSBuildTaskHost/TypeLoader.cs b/src/MSBuildTaskHost/TypeLoader.cs index 7873c23f9d..30791f1966 100644 --- a/src/MSBuildTaskHost/TypeLoader.cs +++ b/src/MSBuildTaskHost/TypeLoader.cs @@ -221,7 +221,7 @@ namespace Microsoft.Build.Shared internal AssemblyInfoToLoadedTypes(TypeFilter typeFilter, AssemblyLoadInfo loadInfo) { ErrorUtilities.VerifyThrowArgumentNull(typeFilter, "typefilter"); - ErrorUtilities.VerifyThrowArgumentNull(loadInfo, nameof(loadInfo)); + ErrorUtilities.VerifyThrowArgumentNull(loadInfo); _isDesiredType = typeFilter; _assemblyLoadInfo = loadInfo; @@ -234,7 +234,7 @@ namespace Microsoft.Build.Shared /// internal LoadedType GetLoadedTypeByTypeName(string typeName) { - ErrorUtilities.VerifyThrowArgumentNull(typeName, nameof(typeName)); + ErrorUtilities.VerifyThrowArgumentNull(typeName); // Only one thread should be doing operations on this instance of the object at a time. diff --git a/src/Shared/AssemblyFolders/AssemblyFoldersFromConfig.cs b/src/Shared/AssemblyFolders/AssemblyFoldersFromConfig.cs index b9e55b4419..b546b28ccb 100644 --- a/src/Shared/AssemblyFolders/AssemblyFoldersFromConfig.cs +++ b/src/Shared/AssemblyFolders/AssemblyFoldersFromConfig.cs @@ -29,8 +29,8 @@ namespace Microsoft.Build.Tasks.AssemblyFoldersFromConfig /// The to target. internal AssemblyFoldersFromConfig(string configFile, string targetRuntimeVersion, ProcessorArchitecture targetArchitecture) { - ErrorUtilities.VerifyThrowArgumentNull(configFile, nameof(configFile)); - ErrorUtilities.VerifyThrowArgumentNull(targetRuntimeVersion, nameof(targetRuntimeVersion)); + ErrorUtilities.VerifyThrowArgumentNull(configFile); + ErrorUtilities.VerifyThrowArgumentNull(targetRuntimeVersion); var collection = AssemblyFolderCollection.Load(configFile); var assemblyTargets = GatherVersionStrings(targetRuntimeVersion, collection); diff --git a/src/Shared/AwaitExtensions.cs b/src/Shared/AwaitExtensions.cs index 72e14fda55..711d2dde94 100644 --- a/src/Shared/AwaitExtensions.cs +++ b/src/Shared/AwaitExtensions.cs @@ -55,7 +55,7 @@ namespace Microsoft.Build.Shared /// The awaiter. internal static TaskAwaiter GetAwaiter(this WaitHandle handle) { - ErrorUtilities.VerifyThrowArgumentNull(handle, nameof(handle)); + ErrorUtilities.VerifyThrowArgumentNull(handle); return handle.ToTask().GetAwaiter(); } diff --git a/src/Shared/BuildEventFileInfo.cs b/src/Shared/BuildEventFileInfo.cs index 050a48d88c..317615a5db 100644 --- a/src/Shared/BuildEventFileInfo.cs +++ b/src/Shared/BuildEventFileInfo.cs @@ -97,7 +97,7 @@ namespace Microsoft.Build.Shared /// internal BuildEventFileInfo(string file, XmlException e) : this(e) { - ErrorUtilities.VerifyThrowArgumentNull(file, nameof(file)); + ErrorUtilities.VerifyThrowArgumentNull(file); _file = file; } diff --git a/src/Shared/EventArgsFormatting.cs b/src/Shared/EventArgsFormatting.cs index 643b3761c8..535ef4f4a4 100644 --- a/src/Shared/EventArgsFormatting.cs +++ b/src/Shared/EventArgsFormatting.cs @@ -69,7 +69,7 @@ namespace Microsoft.Build.Shared /// The formatted message string. internal static string FormatEventMessage(BuildErrorEventArgs e) { - ErrorUtilities.VerifyThrowArgumentNull(e, nameof(e)); + ErrorUtilities.VerifyThrowArgumentNull(e); // "error" should not be localized return FormatEventMessage("error", e.Subcategory, e.Message, @@ -86,7 +86,7 @@ namespace Microsoft.Build.Shared /// The formatted message string. internal static string FormatEventMessage(BuildErrorEventArgs e, bool showProjectFile) { - ErrorUtilities.VerifyThrowArgumentNull(e, nameof(e)); + ErrorUtilities.VerifyThrowArgumentNull(e); // "error" should not be localized return FormatEventMessage("error", e.Subcategory, e.Message, @@ -102,7 +102,7 @@ namespace Microsoft.Build.Shared /// The formatted message string. internal static string FormatEventMessage(BuildWarningEventArgs e) { - ErrorUtilities.VerifyThrowArgumentNull(e, nameof(e)); + ErrorUtilities.VerifyThrowArgumentNull(e); // "warning" should not be localized return FormatEventMessage("warning", e.Subcategory, e.Message, @@ -119,7 +119,7 @@ namespace Microsoft.Build.Shared /// The formatted message string. internal static string FormatEventMessage(BuildWarningEventArgs e, bool showProjectFile) { - ErrorUtilities.VerifyThrowArgumentNull(e, nameof(e)); + ErrorUtilities.VerifyThrowArgumentNull(e); // "warning" should not be localized return FormatEventMessage("warning", e.Subcategory, e.Message, @@ -148,7 +148,7 @@ namespace Microsoft.Build.Shared /// The formatted message string. internal static string FormatEventMessage(BuildMessageEventArgs e, bool showProjectFile, string nonNullMessage = null) { - ErrorUtilities.VerifyThrowArgumentNull(e, nameof(e)); + ErrorUtilities.VerifyThrowArgumentNull(e); // "message" should not be localized return FormatEventMessage("message", e.Subcategory, nonNullMessage ?? e.Message, diff --git a/src/Shared/ExtensionFoldersRegistryKey.cs b/src/Shared/ExtensionFoldersRegistryKey.cs index c264311ce1..62df97f47c 100644 --- a/src/Shared/ExtensionFoldersRegistryKey.cs +++ b/src/Shared/ExtensionFoldersRegistryKey.cs @@ -17,8 +17,8 @@ namespace Microsoft.Build.Shared /// internal ExtensionFoldersRegistryKey(string registryKey, Version targetFrameworkVersion) { - ErrorUtilities.VerifyThrowArgumentNull(registryKey, nameof(registryKey)); - ErrorUtilities.VerifyThrowArgumentNull(targetFrameworkVersion, nameof(targetFrameworkVersion)); + ErrorUtilities.VerifyThrowArgumentNull(registryKey); + ErrorUtilities.VerifyThrowArgumentNull(targetFrameworkVersion); RegistryKey = registryKey; TargetFrameworkVersion = targetFrameworkVersion; diff --git a/src/Shared/FileUtilities.cs b/src/Shared/FileUtilities.cs index d2d6108add..283908712a 100644 --- a/src/Shared/FileUtilities.cs +++ b/src/Shared/FileUtilities.cs @@ -1125,7 +1125,7 @@ namespace Microsoft.Build.Shared /// relative path (can be the full path) internal static string MakeRelative(string basePath, string path) { - ErrorUtilities.VerifyThrowArgumentNull(basePath, nameof(basePath)); + ErrorUtilities.VerifyThrowArgumentNull(basePath); ErrorUtilities.VerifyThrowArgumentLength(path, nameof(path)); string fullBase = Path.GetFullPath(basePath); @@ -1263,8 +1263,8 @@ namespace Microsoft.Build.Shared /// Combined path. internal static string CombinePaths(string root, params string[] paths) { - ErrorUtilities.VerifyThrowArgumentNull(root, nameof(root)); - ErrorUtilities.VerifyThrowArgumentNull(paths, nameof(paths)); + ErrorUtilities.VerifyThrowArgumentNull(root); + ErrorUtilities.VerifyThrowArgumentNull(paths); return paths.Aggregate(root, Path.Combine); } diff --git a/src/Shared/FrameworkLocationHelper.cs b/src/Shared/FrameworkLocationHelper.cs index 4107d4b419..8901b0def2 100644 --- a/src/Shared/FrameworkLocationHelper.cs +++ b/src/Shared/FrameworkLocationHelper.cs @@ -972,8 +972,8 @@ namespace Microsoft.Build.Shared /// The path to the reference assembly location internal static string GenerateReferenceAssemblyPath(string targetFrameworkRootPath, FrameworkName frameworkName) { - ErrorUtilities.VerifyThrowArgumentNull(targetFrameworkRootPath, nameof(targetFrameworkRootPath)); - ErrorUtilities.VerifyThrowArgumentNull(frameworkName, nameof(frameworkName)); + ErrorUtilities.VerifyThrowArgumentNull(targetFrameworkRootPath); + ErrorUtilities.VerifyThrowArgumentNull(frameworkName); try { diff --git a/src/Shared/NodeEndpointOutOfProcBase.cs b/src/Shared/NodeEndpointOutOfProcBase.cs index 55cfb842bd..7e8e8506a8 100644 --- a/src/Shared/NodeEndpointOutOfProcBase.cs +++ b/src/Shared/NodeEndpointOutOfProcBase.cs @@ -152,7 +152,7 @@ namespace Microsoft.Build.BackEnd public void Listen(INodePacketFactory factory) { ErrorUtilities.VerifyThrow(_status == LinkStatus.Inactive, "Link not inactive. Status is {0}", _status); - ErrorUtilities.VerifyThrowArgumentNull(factory, nameof(factory)); + ErrorUtilities.VerifyThrowArgumentNull(factory); _packetFactory = factory; InitializeAsyncPacketThread(); @@ -314,7 +314,7 @@ namespace Microsoft.Build.BackEnd /// The packet to be transmitted. private void EnqueuePacket(INodePacket packet) { - ErrorUtilities.VerifyThrowArgumentNull(packet, nameof(packet)); + ErrorUtilities.VerifyThrowArgumentNull(packet); ErrorUtilities.VerifyThrow(_packetQueue != null, "packetQueue is null"); ErrorUtilities.VerifyThrow(_packetAvailable != null, "packetAvailable is null"); _packetQueue.Enqueue(packet); diff --git a/src/Shared/ReadOnlyCollection.cs b/src/Shared/ReadOnlyCollection.cs index c3a13f5e58..c1754eaf86 100644 --- a/src/Shared/ReadOnlyCollection.cs +++ b/src/Shared/ReadOnlyCollection.cs @@ -129,7 +129,7 @@ namespace Microsoft.Build.Collections /// public void CopyTo(T[] array, int arrayIndex) { - ErrorUtilities.VerifyThrowArgumentNull(array, nameof(array)); + ErrorUtilities.VerifyThrowArgumentNull(array); ICollection backingCollection = _backing as ICollection; if (backingCollection != null) @@ -185,7 +185,7 @@ namespace Microsoft.Build.Collections /// void ICollection.CopyTo(Array array, int index) { - ErrorUtilities.VerifyThrowArgumentNull(array, nameof(array)); + ErrorUtilities.VerifyThrowArgumentNull(array); int i = index; foreach (T entry in _backing) diff --git a/src/Shared/StringExtensions.cs b/src/Shared/StringExtensions.cs index 4fcf361bac..ecdc3c2187 100644 --- a/src/Shared/StringExtensions.cs +++ b/src/Shared/StringExtensions.cs @@ -15,8 +15,8 @@ namespace Microsoft.Build.Shared { public static string Replace(this string aString, string oldValue, string newValue, StringComparison stringComparison) { - ErrorUtilities.VerifyThrowArgumentNull(aString, nameof(aString)); - ErrorUtilities.VerifyThrowArgumentNull(oldValue, nameof(oldValue)); + ErrorUtilities.VerifyThrowArgumentNull(aString); + ErrorUtilities.VerifyThrowArgumentNull(oldValue); ErrorUtilities.VerifyThrowArgumentLength(oldValue, nameof(oldValue)); if (newValue == null) diff --git a/src/Shared/TaskLoggingHelper.cs b/src/Shared/TaskLoggingHelper.cs index 9a5315b1b3..17c26a6b81 100644 --- a/src/Shared/TaskLoggingHelper.cs +++ b/src/Shared/TaskLoggingHelper.cs @@ -48,7 +48,7 @@ namespace Microsoft.Build.Utilities /// task containing an instance of this class public TaskLoggingHelper(ITask taskInstance) { - ErrorUtilities.VerifyThrowArgumentNull(taskInstance, nameof(taskInstance)); + ErrorUtilities.VerifyThrowArgumentNull(taskInstance); _taskInstance = taskInstance; TaskName = taskInstance.GetType().Name; } @@ -58,7 +58,7 @@ namespace Microsoft.Build.Utilities /// public TaskLoggingHelper(IBuildEngine buildEngine, string taskName) { - ErrorUtilities.VerifyThrowArgumentNull(buildEngine, nameof(buildEngine)); + ErrorUtilities.VerifyThrowArgumentNull(buildEngine); ErrorUtilities.VerifyThrowArgumentLength(taskName, nameof(taskName)); TaskName = taskName; _buildEngine = buildEngine; @@ -177,7 +177,7 @@ namespace Microsoft.Build.Utilities /// Thrown when message is null. public string ExtractMessageCode(string message, out string messageWithoutCodePrefix) { - ErrorUtilities.VerifyThrowArgumentNull(message, nameof(message)); + ErrorUtilities.VerifyThrowArgumentNull(message); messageWithoutCodePrefix = ResourceUtilities.ExtractMessageCode(false /* any code */, message, out string code); @@ -201,7 +201,7 @@ namespace Microsoft.Build.Utilities /// Thrown when the TaskResources property of the owner task is not set. public virtual string FormatResourceString(string resourceName, params object[] args) { - ErrorUtilities.VerifyThrowArgumentNull(resourceName, nameof(resourceName)); + ErrorUtilities.VerifyThrowArgumentNull(resourceName); ErrorUtilities.VerifyThrowInvalidOperation(TaskResources != null, "Shared.TaskResourcesNotRegistered", TaskName); string resourceString = TaskResources.GetString(resourceName, CultureInfo.CurrentUICulture); @@ -221,7 +221,7 @@ namespace Microsoft.Build.Utilities /// Thrown when unformatted is null. public virtual string FormatString(string unformatted, params object[] args) { - ErrorUtilities.VerifyThrowArgumentNull(unformatted, nameof(unformatted)); + ErrorUtilities.VerifyThrowArgumentNull(unformatted); return ResourceUtilities.FormatString(unformatted, args); } @@ -290,7 +290,7 @@ namespace Microsoft.Build.Utilities public void LogMessage(MessageImportance importance, string message, params object[] messageArgs) { // No lock needed, as BuildEngine methods from v4.5 onwards are thread safe. - ErrorUtilities.VerifyThrowArgumentNull(message, nameof(message)); + ErrorUtilities.VerifyThrowArgumentNull(message); #if DEBUG if (messageArgs?.Length > 0) { @@ -360,7 +360,7 @@ namespace Microsoft.Build.Utilities params object[] messageArgs) { // No lock needed, as BuildEngine methods from v4.5 onwards are thread safe. - ErrorUtilities.VerifyThrowArgumentNull(message, nameof(message)); + ErrorUtilities.VerifyThrowArgumentNull(message); if (!LogsMessagesOfImportance(importance)) { @@ -422,7 +422,7 @@ namespace Microsoft.Build.Utilities params object[] messageArgs) { // No lock needed, as BuildEngine methods from v4.5 onwards are thread safe. - ErrorUtilities.VerifyThrowArgumentNull(message, nameof(message)); + ErrorUtilities.VerifyThrowArgumentNull(message); // If BuildEngine is null, task attempted to log before it was set on it, // presumably in its constructor. This is not allowed, and all @@ -486,7 +486,7 @@ namespace Microsoft.Build.Utilities { // No lock needed, as the logging methods are thread safe and the rest does not modify // global state. - ErrorUtilities.VerifyThrowArgumentNull(messageResourceName, nameof(messageResourceName)); + ErrorUtilities.VerifyThrowArgumentNull(messageResourceName); if (!LogsMessagesOfImportance(importance)) { @@ -510,8 +510,8 @@ namespace Microsoft.Build.Utilities /// The content of the file. public void LogIncludeGeneratedFile(string filePath, string content) { - ErrorUtilities.VerifyThrowArgumentNull(filePath, nameof(filePath)); - ErrorUtilities.VerifyThrowArgumentNull(content, nameof(content)); + ErrorUtilities.VerifyThrowArgumentNull(filePath); + ErrorUtilities.VerifyThrowArgumentNull(content); var e = new GeneratedFileUsedEventArgs(filePath, content); @@ -601,7 +601,7 @@ namespace Microsoft.Build.Utilities public void LogCommandLine(MessageImportance importance, string commandLine) { // No lock needed, as BuildEngine methods from v4.5 onwards are thread safe. - ErrorUtilities.VerifyThrowArgumentNull(commandLine, nameof(commandLine)); + ErrorUtilities.VerifyThrowArgumentNull(commandLine); if (!LogsMessagesOfImportance(importance)) { @@ -697,7 +697,7 @@ namespace Microsoft.Build.Utilities params object[] messageArgs) { // No lock needed, as BuildEngine methods from v4.5 onwards are thread safe. - ErrorUtilities.VerifyThrowArgumentNull(message, nameof(message)); + ErrorUtilities.VerifyThrowArgumentNull(message); // If BuildEngine is null, task attempted to log before it was set on it, // presumably in its constructor. This is not allowed, and all @@ -774,7 +774,7 @@ namespace Microsoft.Build.Utilities { // No lock needed, as the logging methods are thread safe and the rest does not modify // global state. - ErrorUtilities.VerifyThrowArgumentNull(messageResourceName, nameof(messageResourceName)); + ErrorUtilities.VerifyThrowArgumentNull(messageResourceName); string subcategory = null; @@ -857,7 +857,7 @@ namespace Microsoft.Build.Utilities { // No lock needed, as the logging methods are thread safe and the rest does not modify // global state. - ErrorUtilities.VerifyThrowArgumentNull(messageResourceName, nameof(messageResourceName)); + ErrorUtilities.VerifyThrowArgumentNull(messageResourceName); string subcategory = null; @@ -925,7 +925,7 @@ namespace Microsoft.Build.Utilities { // No lock needed, as the logging methods are thread safe and the rest does not modify // global state. - ErrorUtilities.VerifyThrowArgumentNull(exception, nameof(exception)); + ErrorUtilities.VerifyThrowArgumentNull(exception); // For an AggregateException call LogErrorFromException on each inner exception if (exception is AggregateException aggregateException) @@ -1048,7 +1048,7 @@ namespace Microsoft.Build.Utilities params object[] messageArgs) { // No lock needed, as BuildEngine methods from v4.5 onwards are thread safe. - ErrorUtilities.VerifyThrowArgumentNull(message, nameof(message)); + ErrorUtilities.VerifyThrowArgumentNull(message); // If BuildEngine is null, task attempted to log before it was set on it, // presumably in its constructor. This is not allowed, and all @@ -1144,7 +1144,7 @@ namespace Microsoft.Build.Utilities { // No lock needed, as log methods are thread safe and the rest does not modify // global state. - ErrorUtilities.VerifyThrowArgumentNull(messageResourceName, nameof(messageResourceName)); + ErrorUtilities.VerifyThrowArgumentNull(messageResourceName); string subcategory = null; @@ -1225,7 +1225,7 @@ namespace Microsoft.Build.Utilities { // No lock needed, as log methods are thread safe and the rest does not modify // global state. - ErrorUtilities.VerifyThrowArgumentNull(messageResourceName, nameof(messageResourceName)); + ErrorUtilities.VerifyThrowArgumentNull(messageResourceName); string subcategory = null; @@ -1277,7 +1277,7 @@ namespace Microsoft.Build.Utilities { // No lock needed, as log methods are thread safe and the rest does not modify // global state. - ErrorUtilities.VerifyThrowArgumentNull(exception, nameof(exception)); + ErrorUtilities.VerifyThrowArgumentNull(exception); string message = exception.Message; @@ -1319,7 +1319,7 @@ namespace Microsoft.Build.Utilities { // No lock needed, as log methods are thread safe and the rest does not modify // global state. - ErrorUtilities.VerifyThrowArgumentNull(fileName, nameof(fileName)); + ErrorUtilities.VerifyThrowArgumentNull(fileName); bool errorsFound; @@ -1346,7 +1346,7 @@ namespace Microsoft.Build.Utilities { // No lock needed, as log methods are thread safe and the rest does not modify // global state. - ErrorUtilities.VerifyThrowArgumentNull(stream, nameof(stream)); + ErrorUtilities.VerifyThrowArgumentNull(stream); bool errorsFound = false; string lineOfText; @@ -1374,7 +1374,7 @@ namespace Microsoft.Build.Utilities { // No lock needed, as log methods are thread safe and the rest does not modify // global state. - ErrorUtilities.VerifyThrowArgumentNull(lineOfText, nameof(lineOfText)); + ErrorUtilities.VerifyThrowArgumentNull(lineOfText); bool isError = false; CanonicalError.Parts messageParts = CanonicalError.Parse(lineOfText); diff --git a/src/Shared/TaskLoggingHelperExtension.cs b/src/Shared/TaskLoggingHelperExtension.cs index 5820040361..a666e06e70 100644 --- a/src/Shared/TaskLoggingHelperExtension.cs +++ b/src/Shared/TaskLoggingHelperExtension.cs @@ -90,7 +90,7 @@ namespace Microsoft.Build.Tasks /// Thrown when the TaskResources property of the owner task is not set. public override string FormatResourceString(string resourceName, params object[] args) { - ErrorUtilities.VerifyThrowArgumentNull(resourceName, nameof(resourceName)); + ErrorUtilities.VerifyThrowArgumentNull(resourceName); ErrorUtilities.VerifyThrowInvalidOperation(TaskResources != null, "Shared.TaskResourcesNotRegistered", TaskName); ErrorUtilities.VerifyThrowInvalidOperation(TaskSharedResources != null, "Shared.TaskResourcesNotRegistered", TaskName); diff --git a/src/Shared/TaskParameter.cs b/src/Shared/TaskParameter.cs index 79e0ea3700..6e237e30fb 100644 --- a/src/Shared/TaskParameter.cs +++ b/src/Shared/TaskParameter.cs @@ -862,7 +862,7 @@ namespace Microsoft.Build.BackEnd /// The name of the metadata to remove. public void RemoveMetadata(string metadataName) { - ErrorUtilities.VerifyThrowArgumentNull(metadataName, nameof(metadataName)); + ErrorUtilities.VerifyThrowArgumentNull(metadataName); ErrorUtilities.VerifyThrowArgument(!FileUtilities.ItemSpecModifiers.IsItemSpecModifier(metadataName), "Shared.CannotChangeItemSpecModifiers", metadataName); if (_customEscapedMetadata == null) @@ -885,7 +885,7 @@ namespace Microsoft.Build.BackEnd /// The item to copy metadata to. public void CopyMetadataTo(ITaskItem destinationItem) { - ErrorUtilities.VerifyThrowArgumentNull(destinationItem, nameof(destinationItem)); + ErrorUtilities.VerifyThrowArgumentNull(destinationItem); // also copy the original item-spec under a "magic" metadata -- this is useful for tasks that forward metadata // between items, and need to know the source item where the metadata came from @@ -952,7 +952,7 @@ namespace Microsoft.Build.BackEnd /// string ITaskItem2.GetMetadataValueEscaped(string metadataName) { - ErrorUtilities.VerifyThrowArgumentNull(metadataName, nameof(metadataName)); + ErrorUtilities.VerifyThrowArgumentNull(metadataName); string metadataValue = null; diff --git a/src/Shared/TypeLoader.cs b/src/Shared/TypeLoader.cs index f9426436f8..3a3013b36a 100644 --- a/src/Shared/TypeLoader.cs +++ b/src/Shared/TypeLoader.cs @@ -307,7 +307,7 @@ namespace Microsoft.Build.Shared internal AssemblyInfoToLoadedTypes(Func typeFilter, AssemblyLoadInfo loadInfo) { ErrorUtilities.VerifyThrowArgumentNull(typeFilter, "typefilter"); - ErrorUtilities.VerifyThrowArgumentNull(loadInfo, nameof(loadInfo)); + ErrorUtilities.VerifyThrowArgumentNull(loadInfo); _isDesiredType = typeFilter; _assemblyLoadInfo = loadInfo; @@ -321,7 +321,7 @@ namespace Microsoft.Build.Shared /// internal LoadedType GetLoadedTypeByTypeName(string typeName, bool useTaskHost) { - ErrorUtilities.VerifyThrowArgumentNull(typeName, nameof(typeName)); + ErrorUtilities.VerifyThrowArgumentNull(typeName); if (useTaskHost && _assemblyLoadInfo.AssemblyFile is not null) { diff --git a/src/Tasks/AssemblyDependency/AssemblyInformation.cs b/src/Tasks/AssemblyDependency/AssemblyInformation.cs index 1c5480263e..531d95a8fc 100644 --- a/src/Tasks/AssemblyDependency/AssemblyInformation.cs +++ b/src/Tasks/AssemblyDependency/AssemblyInformation.cs @@ -71,7 +71,7 @@ namespace Microsoft.Build.Tasks internal AssemblyInformation(string sourceFile) { // Extra checks for PInvoke-destined data. - ErrorUtilities.VerifyThrowArgumentNull(sourceFile, nameof(sourceFile)); + ErrorUtilities.VerifyThrowArgumentNull(sourceFile); _sourceFile = sourceFile; #if !FEATURE_ASSEMBLYLOADCONTEXT diff --git a/src/Tasks/AssemblyDependency/GlobalAssemblyCache.cs b/src/Tasks/AssemblyDependency/GlobalAssemblyCache.cs index 330b6b50d4..daeaae94b3 100644 --- a/src/Tasks/AssemblyDependency/GlobalAssemblyCache.cs +++ b/src/Tasks/AssemblyDependency/GlobalAssemblyCache.cs @@ -56,7 +56,7 @@ namespace Microsoft.Build.Tasks private static string GetLocationImpl(AssemblyNameExtension assemblyName, string targetProcessorArchitecture, GetAssemblyRuntimeVersion getRuntimeVersion, Version targetedRuntime, FileExists fileExists, GetPathFromFusionName getPathFromFusionName, GetGacEnumerator getGacEnumerator, bool specificVersion) { // Extra checks for PInvoke-destined data. - ErrorUtilities.VerifyThrowArgumentNull(assemblyName, nameof(assemblyName)); + ErrorUtilities.VerifyThrowArgumentNull(assemblyName); ErrorUtilities.VerifyThrow(assemblyName.FullName != null, "Got a null assembly name fullname."); string strongName = assemblyName.FullName; @@ -117,7 +117,7 @@ namespace Microsoft.Build.Tasks /// private static SortedDictionary> GenerateListOfAssembliesByRuntime(string strongName, GetAssemblyRuntimeVersion getRuntimeVersion, Version targetedRuntime, FileExists fileExists, GetPathFromFusionName getPathFromFusionName, GetGacEnumerator getGacEnumerator, bool specificVersion) { - ErrorUtilities.VerifyThrowArgumentNull(targetedRuntime, nameof(targetedRuntime)); + ErrorUtilities.VerifyThrowArgumentNull(targetedRuntime); IEnumerable gacEnum = getGacEnumerator(strongName); @@ -178,7 +178,7 @@ namespace Microsoft.Build.Tasks internal static string RetrievePathFromFusionName(string strongName) { // Extra checks for PInvoke-destined data. - ErrorUtilities.VerifyThrowArgumentNull(strongName, nameof(strongName)); + ErrorUtilities.VerifyThrowArgumentNull(strongName); string value; diff --git a/src/Tasks/AssemblyDependency/ResolveAssemblyReference.cs b/src/Tasks/AssemblyDependency/ResolveAssemblyReference.cs index a0f8ea6bb7..9b06868500 100644 --- a/src/Tasks/AssemblyDependency/ResolveAssemblyReference.cs +++ b/src/Tasks/AssemblyDependency/ResolveAssemblyReference.cs @@ -1746,7 +1746,7 @@ namespace Microsoft.Build.Tasks /// The importance of the message. private void LogFullName(Reference reference, MessageImportance importance) { - ErrorUtilities.VerifyThrowArgumentNull(reference, nameof(reference)); + ErrorUtilities.VerifyThrowArgumentNull(reference); if (reference.IsResolved) { @@ -1801,7 +1801,7 @@ namespace Microsoft.Build.Tasks else { Log.LogMessage(importance, Strings.SearchPath, lastSearchPath); - } + } if (logAssemblyFoldersMinimal) { Log.LogMessage(importance, Strings.SearchedAssemblyFoldersEx); diff --git a/src/Tasks/AssemblyRegistrationCache.cs b/src/Tasks/AssemblyRegistrationCache.cs index b4975263b9..5a28c315c2 100644 --- a/src/Tasks/AssemblyRegistrationCache.cs +++ b/src/Tasks/AssemblyRegistrationCache.cs @@ -64,7 +64,7 @@ namespace Microsoft.Build.Tasks public override void Translate(ITranslator translator) { - ErrorUtilities.VerifyThrowArgumentNull(translator, nameof(translator)); + ErrorUtilities.VerifyThrowArgumentNull(translator); translator.Translate(ref _assemblies); translator.Translate(ref _typeLibraries); } diff --git a/src/Tasks/CodeTaskFactory.cs b/src/Tasks/CodeTaskFactory.cs index 2b996326fc..cd6952401b 100644 --- a/src/Tasks/CodeTaskFactory.cs +++ b/src/Tasks/CodeTaskFactory.cs @@ -344,7 +344,7 @@ namespace Microsoft.Build.Tasks /// public void CleanupTask(ITask task) { - ErrorUtilities.VerifyThrowArgumentNull(task, nameof(task)); + ErrorUtilities.VerifyThrowArgumentNull(task); } /// diff --git a/src/Tasks/ComReferenceInfo.cs b/src/Tasks/ComReferenceInfo.cs index c813f7a2e0..8a9aadf3e4 100644 --- a/src/Tasks/ComReferenceInfo.cs +++ b/src/Tasks/ComReferenceInfo.cs @@ -134,7 +134,7 @@ namespace Microsoft.Build.Tasks /// internal bool InitializeWithPath(TaskLoggingHelper log, bool silent, string path, ITaskItem originalTaskItem, string targetProcessorArchitecture) { - ErrorUtilities.VerifyThrowArgumentNull(path, nameof(path)); + ErrorUtilities.VerifyThrowArgumentNull(path); this.taskItem = originalTaskItem; diff --git a/src/Tasks/CreateManifestResourceName.cs b/src/Tasks/CreateManifestResourceName.cs index 818e984b1f..934d67c6a6 100644 --- a/src/Tasks/CreateManifestResourceName.cs +++ b/src/Tasks/CreateManifestResourceName.cs @@ -295,7 +295,7 @@ namespace Microsoft.Build.Tasks /// private static void MakeValidEverettSubFolderIdentifier(StringBuilder builder, string subName) { - ErrorUtilities.VerifyThrowArgumentNull(subName, nameof(subName)); + ErrorUtilities.VerifyThrowArgumentNull(subName); if (string.IsNullOrEmpty(subName)) { return; } @@ -333,7 +333,7 @@ namespace Microsoft.Build.Tasks /// internal static void MakeValidEverettFolderIdentifier(StringBuilder builder, string name) { - ErrorUtilities.VerifyThrowArgumentNull(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentNull(name); if (string.IsNullOrEmpty(name)) { return; } @@ -365,7 +365,7 @@ namespace Microsoft.Build.Tasks /// public static string MakeValidEverettIdentifier(string name) { - ErrorUtilities.VerifyThrowArgumentNull(name, nameof(name)); + ErrorUtilities.VerifyThrowArgumentNull(name); if (string.IsNullOrEmpty(name)) { return name; } var everettId = new StringBuilder(name.Length); diff --git a/src/Tasks/RedistList.cs b/src/Tasks/RedistList.cs index e94588e426..f5476e2f9f 100644 --- a/src/Tasks/RedistList.cs +++ b/src/Tasks/RedistList.cs @@ -291,7 +291,7 @@ namespace Microsoft.Build.Tasks /// Array of paths to redist lists under given framework directory. public static string[] GetRedistListPathsFromDisk(string frameworkDirectory) { - ErrorUtilities.VerifyThrowArgumentNull(frameworkDirectory, nameof(frameworkDirectory)); + ErrorUtilities.VerifyThrowArgumentNull(frameworkDirectory); lock (s_locker) { @@ -429,7 +429,7 @@ namespace Microsoft.Build.Tasks /// public bool FrameworkAssemblyEntryInRedist(AssemblyNameExtension assemblyName) { - ErrorUtilities.VerifyThrowArgumentNull(assemblyName, nameof(assemblyName)); + ErrorUtilities.VerifyThrowArgumentNull(assemblyName); if (!_assemblyNameInRedist.TryGetValue(assemblyName, out bool isAssemblyNameInRedist)) { @@ -991,7 +991,7 @@ namespace Microsoft.Build.Tasks /// found in the target framework directories. This can happen if the subsets are instead passed in as InstalledDefaultSubsetTables internal SubsetListFinder(string[] subsetToSearchFor) { - ErrorUtilities.VerifyThrowArgumentNull(subsetToSearchFor, nameof(subsetToSearchFor)); + ErrorUtilities.VerifyThrowArgumentNull(subsetToSearchFor); _subsetToSearchFor = subsetToSearchFor; } @@ -1015,7 +1015,7 @@ namespace Microsoft.Build.Tasks /// Array of paths locations to subset lists under the given framework directory. public string[] GetSubsetListPathsFromDisk(string frameworkDirectory) { - ErrorUtilities.VerifyThrowArgumentNull(frameworkDirectory, nameof(frameworkDirectory)); + ErrorUtilities.VerifyThrowArgumentNull(frameworkDirectory); // Make sure we have some subset names to search for it is possible that no subsets are asked for // so we should return as quickly as possible in that case. diff --git a/src/Tasks/RegisterAssembly.cs b/src/Tasks/RegisterAssembly.cs index 46999b3771..9df37305f5 100644 --- a/src/Tasks/RegisterAssembly.cs +++ b/src/Tasks/RegisterAssembly.cs @@ -192,7 +192,7 @@ namespace Microsoft.Build.Tasks /// public object ResolveRef(Assembly assemblyToResolve) { - ErrorUtilities.VerifyThrowArgumentNull(assemblyToResolve, nameof(assemblyToResolve)); + ErrorUtilities.VerifyThrowArgumentNull(assemblyToResolve); Log.LogErrorWithCodeFromResources("RegisterAssembly.AssemblyNotRegisteredForComInterop", assemblyToResolve.GetName().FullName); _typeLibExportFailed = true; @@ -208,7 +208,7 @@ namespace Microsoft.Build.Tasks /// private bool Register(string assemblyPath, string typeLibPath) { - ErrorUtilities.VerifyThrowArgumentNull(typeLibPath, nameof(typeLibPath)); + ErrorUtilities.VerifyThrowArgumentNull(typeLibPath); Log.LogMessageFromResources(MessageImportance.Low, "RegisterAssembly.RegisteringAssembly", assemblyPath); diff --git a/src/Tasks/ResolveComReferenceCache.cs b/src/Tasks/ResolveComReferenceCache.cs index ee7b4577a9..491e03d3ab 100644 --- a/src/Tasks/ResolveComReferenceCache.cs +++ b/src/Tasks/ResolveComReferenceCache.cs @@ -41,8 +41,8 @@ namespace Microsoft.Build.Tasks /// internal ResolveComReferenceCache(string tlbImpPath, string axImpPath) { - ErrorUtilities.VerifyThrowArgumentNull(tlbImpPath, nameof(tlbImpPath)); - ErrorUtilities.VerifyThrowArgumentNull(axImpPath, nameof(axImpPath)); + ErrorUtilities.VerifyThrowArgumentNull(tlbImpPath); + ErrorUtilities.VerifyThrowArgumentNull(axImpPath); tlbImpLocation = tlbImpPath; axImpLocation = axImpPath; diff --git a/src/Tasks/ResolveSDKReference.cs b/src/Tasks/ResolveSDKReference.cs index 824bb439e4..9a71741922 100644 --- a/src/Tasks/ResolveSDKReference.cs +++ b/src/Tasks/ResolveSDKReference.cs @@ -726,7 +726,7 @@ namespace Microsoft.Build.Tasks /// public SDKReference(ITaskItem taskItem, string sdkName, string sdkVersion) { - ErrorUtilities.VerifyThrowArgumentNull(taskItem, nameof(taskItem)); + ErrorUtilities.VerifyThrowArgumentNull(taskItem); ErrorUtilities.VerifyThrowArgumentLength(sdkName, nameof(sdkName)); ErrorUtilities.VerifyThrowArgumentLength(sdkVersion, nameof(sdkVersion)); diff --git a/src/Tasks/StrongNameUtils.cs b/src/Tasks/StrongNameUtils.cs index ca6fb28ce1..26fce85247 100644 --- a/src/Tasks/StrongNameUtils.cs +++ b/src/Tasks/StrongNameUtils.cs @@ -137,7 +137,7 @@ namespace Microsoft.Build.Tasks /// internal static StrongNameLevel GetAssemblyStrongNameLevel(string assemblyPath) { - ErrorUtilities.VerifyThrowArgumentNull(assemblyPath, nameof(assemblyPath)); + ErrorUtilities.VerifyThrowArgumentNull(assemblyPath); StrongNameLevel snLevel = StrongNameLevel.Unknown; IntPtr fileHandle = NativeMethods.InvalidIntPtr; diff --git a/src/Tasks/SystemState.cs b/src/Tasks/SystemState.cs index cb7031ecb5..cf3ad3dad9 100644 --- a/src/Tasks/SystemState.cs +++ b/src/Tasks/SystemState.cs @@ -168,7 +168,7 @@ namespace Microsoft.Build.Tasks /// public void Translate(ITranslator translator) { - ErrorUtilities.VerifyThrowArgumentNull(translator, nameof(translator)); + ErrorUtilities.VerifyThrowArgumentNull(translator); translator.Translate(ref lastModified); translator.Translate(ref assemblyName, diff --git a/src/Tasks/UnregisterAssembly.cs b/src/Tasks/UnregisterAssembly.cs index 6060fb33b8..69f5e8425d 100644 --- a/src/Tasks/UnregisterAssembly.cs +++ b/src/Tasks/UnregisterAssembly.cs @@ -150,7 +150,7 @@ namespace Microsoft.Build.Tasks /// private bool Unregister(string assemblyPath, string typeLibPath) { - ErrorUtilities.VerifyThrowArgumentNull(typeLibPath, nameof(typeLibPath)); + ErrorUtilities.VerifyThrowArgumentNull(typeLibPath); Log.LogMessageFromResources(MessageImportance.Low, "UnregisterAssembly.UnregisteringAssembly", assemblyPath); diff --git a/src/Tasks/XamlTaskFactory/CommandLineGenerator.cs b/src/Tasks/XamlTaskFactory/CommandLineGenerator.cs index c97bcb4555..1ef6c1ec72 100644 --- a/src/Tasks/XamlTaskFactory/CommandLineGenerator.cs +++ b/src/Tasks/XamlTaskFactory/CommandLineGenerator.cs @@ -37,8 +37,8 @@ namespace Microsoft.Build.Tasks.Xaml /// public CommandLineGenerator(Rule rule, Dictionary parameterValues) { - ErrorUtilities.VerifyThrowArgumentNull(rule, nameof(rule)); - ErrorUtilities.VerifyThrowArgumentNull(parameterValues, nameof(parameterValues)); + ErrorUtilities.VerifyThrowArgumentNull(rule); + ErrorUtilities.VerifyThrowArgumentNull(parameterValues); // Parse the Xaml file var parser = new TaskParser(); diff --git a/src/Tasks/XamlTaskFactory/TaskParser.cs b/src/Tasks/XamlTaskFactory/TaskParser.cs index 626a1a9258..1a50acf29c 100644 --- a/src/Tasks/XamlTaskFactory/TaskParser.cs +++ b/src/Tasks/XamlTaskFactory/TaskParser.cs @@ -186,7 +186,7 @@ namespace Microsoft.Build.Tasks.Xaml /// internal bool ParseXamlDocument(TextReader reader, string desiredRule) { - ErrorUtilities.VerifyThrowArgumentNull(reader, nameof(reader)); + ErrorUtilities.VerifyThrowArgumentNull(reader); ErrorUtilities.VerifyThrowArgumentLength(desiredRule, nameof(desiredRule)); object rootObject = XamlServices.Load(reader); diff --git a/src/Tasks/XamlTaskFactory/XamlTaskFactory.cs b/src/Tasks/XamlTaskFactory/XamlTaskFactory.cs index b2823627ff..e74251b8bb 100644 --- a/src/Tasks/XamlTaskFactory/XamlTaskFactory.cs +++ b/src/Tasks/XamlTaskFactory/XamlTaskFactory.cs @@ -84,8 +84,8 @@ namespace Microsoft.Build.Tasks /// public bool Initialize(string taskName, IDictionary taskParameters, string taskElementContents, IBuildEngine taskFactoryLoggingHost) { - ErrorUtilities.VerifyThrowArgumentNull(taskName, nameof(taskName)); - ErrorUtilities.VerifyThrowArgumentNull(taskParameters, nameof(taskParameters)); + ErrorUtilities.VerifyThrowArgumentNull(taskName); + ErrorUtilities.VerifyThrowArgumentNull(taskParameters); var log = new TaskLoggingHelper(taskFactoryLoggingHost, taskName) { @@ -210,7 +210,7 @@ namespace Microsoft.Build.Tasks /// public void CleanupTask(ITask task) { - ErrorUtilities.VerifyThrowArgumentNull(task, nameof(task)); + ErrorUtilities.VerifyThrowArgumentNull(task); } /// diff --git a/src/UnitTests.Shared/ObjectModelHelpers.cs b/src/UnitTests.Shared/ObjectModelHelpers.cs index 1d560f5431..4e38ceba1d 100644 --- a/src/UnitTests.Shared/ObjectModelHelpers.cs +++ b/src/UnitTests.Shared/ObjectModelHelpers.cs @@ -1127,7 +1127,7 @@ namespace Microsoft.Build.UnitTests { public static string Format(this string s, params object[] formatItems) { - ErrorUtilities.VerifyThrowArgumentNull(s, nameof(s)); + ErrorUtilities.VerifyThrowArgumentNull(s); return string.Format(s, formatItems); } diff --git a/src/Utilities.UnitTests/TaskItem_Tests.cs b/src/Utilities.UnitTests/TaskItem_Tests.cs index c8ed9e9832..04a54e3e51 100644 --- a/src/Utilities.UnitTests/TaskItem_Tests.cs +++ b/src/Utilities.UnitTests/TaskItem_Tests.cs @@ -428,7 +428,7 @@ namespace Microsoft.Build.UnitTests /// public void Run(string[] includes, IDictionary metadataToAdd) { - ErrorUtilities.VerifyThrowArgumentNull(includes, nameof(includes)); + ErrorUtilities.VerifyThrowArgumentNull(includes); CreatedTaskItems = new TaskItem[includes.Length]; diff --git a/src/Utilities/AssemblyFolders/AssemblyFoldersExInfo.cs b/src/Utilities/AssemblyFolders/AssemblyFoldersExInfo.cs index 21c8b7531f..8c9fae05bf 100644 --- a/src/Utilities/AssemblyFolders/AssemblyFoldersExInfo.cs +++ b/src/Utilities/AssemblyFolders/AssemblyFoldersExInfo.cs @@ -21,9 +21,9 @@ namespace Microsoft.Build.Utilities /// public AssemblyFoldersExInfo(RegistryHive hive, RegistryView view, string registryKey, string directoryPath, Version targetFrameworkVersion) { - ErrorUtilities.VerifyThrowArgumentNull(registryKey, nameof(registryKey)); - ErrorUtilities.VerifyThrowArgumentNull(directoryPath, nameof(directoryPath)); - ErrorUtilities.VerifyThrowArgumentNull(targetFrameworkVersion, nameof(targetFrameworkVersion)); + ErrorUtilities.VerifyThrowArgumentNull(registryKey); + ErrorUtilities.VerifyThrowArgumentNull(directoryPath); + ErrorUtilities.VerifyThrowArgumentNull(targetFrameworkVersion); Hive = hive; View = view; diff --git a/src/Utilities/AssemblyFolders/AssemblyFoldersFromConfigInfo.cs b/src/Utilities/AssemblyFolders/AssemblyFoldersFromConfigInfo.cs index bc93eff490..008dc6034b 100644 --- a/src/Utilities/AssemblyFolders/AssemblyFoldersFromConfigInfo.cs +++ b/src/Utilities/AssemblyFolders/AssemblyFoldersFromConfigInfo.cs @@ -23,8 +23,8 @@ namespace Microsoft.Build.Utilities /// The of the target framework. public AssemblyFoldersFromConfigInfo(string directoryPath, Version targetFrameworkVersion) { - ErrorUtilities.VerifyThrowArgumentNull(directoryPath, nameof(directoryPath)); - ErrorUtilities.VerifyThrowArgumentNull(targetFrameworkVersion, nameof(targetFrameworkVersion)); + ErrorUtilities.VerifyThrowArgumentNull(directoryPath); + ErrorUtilities.VerifyThrowArgumentNull(targetFrameworkVersion); // When we get a path, it may be relative to Visual Studio (i.e. reference assemblies). If the // VSInstallDir environment is used, replace with our known location to Visual Studio. diff --git a/src/Utilities/AssemblyResources.cs b/src/Utilities/AssemblyResources.cs index b2a22970d1..3258aecf36 100644 --- a/src/Utilities/AssemblyResources.cs +++ b/src/Utilities/AssemblyResources.cs @@ -53,7 +53,7 @@ namespace Microsoft.Build.Shared /// The formatted string. internal static string FormatString(string unformatted, params object[] args) { - ErrorUtilities.VerifyThrowArgumentNull(unformatted, nameof(unformatted)); + ErrorUtilities.VerifyThrowArgumentNull(unformatted); return ResourceUtilities.FormatString(unformatted, args); } @@ -72,7 +72,7 @@ namespace Microsoft.Build.Shared /// The formatted string. internal static string FormatResourceString(string resourceName, params object[] args) { - ErrorUtilities.VerifyThrowArgumentNull(resourceName, nameof(resourceName)); + ErrorUtilities.VerifyThrowArgumentNull(resourceName); // NOTE: the ResourceManager.GetString() method is thread-safe string resourceString = GetString(resourceName); diff --git a/src/Utilities/CommandLineBuilder.cs b/src/Utilities/CommandLineBuilder.cs index b777f8b702..c41b18d74c 100644 --- a/src/Utilities/CommandLineBuilder.cs +++ b/src/Utilities/CommandLineBuilder.cs @@ -247,7 +247,7 @@ namespace Microsoft.Build.Utilities /// protected void AppendQuotedTextToBuffer(StringBuilder buffer, string unquotedTextToAppend) { - ErrorUtilities.VerifyThrowArgumentNull(buffer, nameof(buffer)); + ErrorUtilities.VerifyThrowArgumentNull(buffer); if (unquotedTextToAppend != null) { @@ -399,7 +399,7 @@ namespace Microsoft.Build.Utilities /// The delimiter between file names public void AppendFileNamesIfNotNull(string[] fileNames, string delimiter) { - ErrorUtilities.VerifyThrowArgumentNull(delimiter, nameof(delimiter)); + ErrorUtilities.VerifyThrowArgumentNull(delimiter); if (fileNames?.Length > 0) { @@ -434,7 +434,7 @@ namespace Microsoft.Build.Utilities /// Delimiter to put between items in the command line public void AppendFileNamesIfNotNull(ITaskItem[] fileItems, string delimiter) { - ErrorUtilities.VerifyThrowArgumentNull(delimiter, nameof(delimiter)); + ErrorUtilities.VerifyThrowArgumentNull(delimiter); if (fileItems?.Length > 0) { @@ -478,7 +478,7 @@ namespace Microsoft.Build.Utilities /// The switch to append to the command line, may not be null public void AppendSwitch(string switchName) { - ErrorUtilities.VerifyThrowArgumentNull(switchName, nameof(switchName)); + ErrorUtilities.VerifyThrowArgumentNull(switchName); AppendSpaceIfNotEmpty(); AppendTextUnquoted(switchName); @@ -495,7 +495,7 @@ namespace Microsoft.Build.Utilities /// Switch parameter to append, quoted if necessary. If null, this method has no effect. public void AppendSwitchIfNotNull(string switchName, string parameter) { - ErrorUtilities.VerifyThrowArgumentNull(switchName, nameof(switchName)); + ErrorUtilities.VerifyThrowArgumentNull(switchName); if (parameter != null) { @@ -544,7 +544,7 @@ namespace Microsoft.Build.Utilities /// Switch parameter to append, quoted if necessary. If null, this method has no effect. public void AppendSwitchIfNotNull(string switchName, ITaskItem parameter) { - ErrorUtilities.VerifyThrowArgumentNull(switchName, nameof(switchName)); + ErrorUtilities.VerifyThrowArgumentNull(switchName); if (parameter != null) { @@ -565,8 +565,8 @@ namespace Microsoft.Build.Utilities /// Delimiter to put between individual parameters, may not be null (may be empty) public void AppendSwitchIfNotNull(string switchName, string[] parameters, string delimiter) { - ErrorUtilities.VerifyThrowArgumentNull(switchName, nameof(switchName)); - ErrorUtilities.VerifyThrowArgumentNull(delimiter, nameof(delimiter)); + ErrorUtilities.VerifyThrowArgumentNull(switchName); + ErrorUtilities.VerifyThrowArgumentNull(delimiter); if (parameters?.Length > 0) { @@ -597,8 +597,8 @@ namespace Microsoft.Build.Utilities /// Delimiter to put between individual parameters, may not be null (may be empty) public void AppendSwitchIfNotNull(string switchName, ITaskItem[] parameters, string delimiter) { - ErrorUtilities.VerifyThrowArgumentNull(switchName, nameof(switchName)); - ErrorUtilities.VerifyThrowArgumentNull(delimiter, nameof(delimiter)); + ErrorUtilities.VerifyThrowArgumentNull(switchName); + ErrorUtilities.VerifyThrowArgumentNull(delimiter); if (parameters?.Length > 0) { @@ -635,7 +635,7 @@ namespace Microsoft.Build.Utilities /// Switch parameter to append, not quoted. If null, this method has no effect. public void AppendSwitchUnquotedIfNotNull(string switchName, string parameter) { - ErrorUtilities.VerifyThrowArgumentNull(switchName, nameof(switchName)); + ErrorUtilities.VerifyThrowArgumentNull(switchName); if (parameter != null) { @@ -656,7 +656,7 @@ namespace Microsoft.Build.Utilities /// Switch parameter to append, not quoted. If null, this method has no effect. public void AppendSwitchUnquotedIfNotNull(string switchName, ITaskItem parameter) { - ErrorUtilities.VerifyThrowArgumentNull(switchName, nameof(switchName)); + ErrorUtilities.VerifyThrowArgumentNull(switchName); if (parameter != null) { @@ -676,8 +676,8 @@ namespace Microsoft.Build.Utilities /// Delimiter to put between individual parameters, may not be null (may be empty) public void AppendSwitchUnquotedIfNotNull(string switchName, string[] parameters, string delimiter) { - ErrorUtilities.VerifyThrowArgumentNull(switchName, nameof(switchName)); - ErrorUtilities.VerifyThrowArgumentNull(delimiter, nameof(delimiter)); + ErrorUtilities.VerifyThrowArgumentNull(switchName); + ErrorUtilities.VerifyThrowArgumentNull(delimiter); if (parameters?.Length > 0) { @@ -707,8 +707,8 @@ namespace Microsoft.Build.Utilities /// Delimiter to put between individual parameters, may not be null (may be empty) public void AppendSwitchUnquotedIfNotNull(string switchName, ITaskItem[] parameters, string delimiter) { - ErrorUtilities.VerifyThrowArgumentNull(switchName, nameof(switchName)); - ErrorUtilities.VerifyThrowArgumentNull(delimiter, nameof(delimiter)); + ErrorUtilities.VerifyThrowArgumentNull(switchName); + ErrorUtilities.VerifyThrowArgumentNull(delimiter); if (parameters?.Length > 0) { diff --git a/src/Utilities/TargetPlatformSDK.cs b/src/Utilities/TargetPlatformSDK.cs index be16c5f63a..8740fe39e1 100644 --- a/src/Utilities/TargetPlatformSDK.cs +++ b/src/Utilities/TargetPlatformSDK.cs @@ -42,8 +42,8 @@ namespace Microsoft.Build.Utilities /// public TargetPlatformSDK(string targetPlatformIdentifier, Version targetPlatformVersion, string path) { - ErrorUtilities.VerifyThrowArgumentNull(targetPlatformIdentifier, nameof(targetPlatformIdentifier)); - ErrorUtilities.VerifyThrowArgumentNull(targetPlatformVersion, nameof(targetPlatformVersion)); + ErrorUtilities.VerifyThrowArgumentNull(targetPlatformIdentifier); + ErrorUtilities.VerifyThrowArgumentNull(targetPlatformVersion); TargetPlatformIdentifier = targetPlatformIdentifier; TargetPlatformVersion = targetPlatformVersion; Path = path; diff --git a/src/Utilities/TaskItem.cs b/src/Utilities/TaskItem.cs index ab2c1fd9b9..d05f69f98c 100644 --- a/src/Utilities/TaskItem.cs +++ b/src/Utilities/TaskItem.cs @@ -80,7 +80,7 @@ namespace Microsoft.Build.Utilities public TaskItem( string itemSpec) { - ErrorUtilities.VerifyThrowArgumentNull(itemSpec, nameof(itemSpec)); + ErrorUtilities.VerifyThrowArgumentNull(itemSpec); _itemSpec = FileUtilities.FixFilePath(itemSpec); } @@ -99,7 +99,7 @@ namespace Microsoft.Build.Utilities IDictionary itemMetadata) : this(itemSpec) { - ErrorUtilities.VerifyThrowArgumentNull(itemMetadata, nameof(itemMetadata)); + ErrorUtilities.VerifyThrowArgumentNull(itemMetadata); if (itemMetadata.Count > 0) { @@ -124,7 +124,7 @@ namespace Microsoft.Build.Utilities public TaskItem( ITaskItem sourceItem) { - ErrorUtilities.VerifyThrowArgumentNull(sourceItem, nameof(sourceItem)); + ErrorUtilities.VerifyThrowArgumentNull(sourceItem); // Attempt to preserve escaped state if (!(sourceItem is ITaskItem2 sourceItemAsITaskItem2)) @@ -243,7 +243,7 @@ namespace Microsoft.Build.Utilities /// Name of metadata to remove. public void RemoveMetadata(string metadataName) { - ErrorUtilities.VerifyThrowArgumentNull(metadataName, nameof(metadataName)); + ErrorUtilities.VerifyThrowArgumentNull(metadataName); ErrorUtilities.VerifyThrowArgument(!FileUtilities.ItemSpecModifiers.IsItemSpecModifier(metadataName), "Shared.CannotChangeItemSpecModifiers", metadataName); @@ -296,7 +296,7 @@ namespace Microsoft.Build.Utilities /// The item to copy metadata to. public void CopyMetadataTo(ITaskItem destinationItem) { - ErrorUtilities.VerifyThrowArgumentNull(destinationItem, nameof(destinationItem)); + ErrorUtilities.VerifyThrowArgumentNull(destinationItem); // also copy the original item-spec under a "magic" metadata -- this is useful for tasks that forward metadata // between items, and need to know the source item where the metadata came from @@ -419,7 +419,7 @@ namespace Microsoft.Build.Utilities /// The item-spec of the item. public static explicit operator string(TaskItem taskItemToCast) { - ErrorUtilities.VerifyThrowArgumentNull(taskItemToCast, nameof(taskItemToCast)); + ErrorUtilities.VerifyThrowArgumentNull(taskItemToCast); return taskItemToCast.ItemSpec; } @@ -432,7 +432,7 @@ namespace Microsoft.Build.Utilities /// string ITaskItem2.GetMetadataValueEscaped(string metadataName) { - ErrorUtilities.VerifyThrowArgumentNull(metadataName, nameof(metadataName)); + ErrorUtilities.VerifyThrowArgumentNull(metadataName); string metadataValue = null; diff --git a/src/Utilities/ToolLocationHelper.cs b/src/Utilities/ToolLocationHelper.cs index 0ee514640f..173301c449 100644 --- a/src/Utilities/ToolLocationHelper.cs +++ b/src/Utilities/ToolLocationHelper.cs @@ -461,7 +461,7 @@ namespace Microsoft.Build.Utilities private static IEnumerable GetTargetPlatformMonikers(string[] diskRoots, string[] extensionDiskRoots, string registryRoot, string targetPlatformIdentifier, Version targetPlatformVersion) { ErrorUtilities.VerifyThrowArgumentLength(targetPlatformIdentifier, nameof(targetPlatformIdentifier)); - ErrorUtilities.VerifyThrowArgumentNull(targetPlatformVersion, nameof(targetPlatformVersion)); + ErrorUtilities.VerifyThrowArgumentNull(targetPlatformVersion); string targetPlatformVersionString = targetPlatformVersion.ToString(); @@ -519,7 +519,7 @@ namespace Microsoft.Build.Utilities public static string GetPlatformExtensionSDKLocation(string sdkMoniker, string targetPlatformIdentifier, Version targetPlatformVersion, string[] diskRoots, string[] extensionDiskRoots, string registryRoot) { ErrorUtilities.VerifyThrowArgumentLength(targetPlatformIdentifier, nameof(targetPlatformIdentifier)); - ErrorUtilities.VerifyThrowArgumentNull(targetPlatformVersion, nameof(targetPlatformVersion)); + ErrorUtilities.VerifyThrowArgumentNull(targetPlatformVersion); ErrorUtilities.VerifyThrowArgumentLength(sdkMoniker, nameof(sdkMoniker)); IEnumerable targetPlatforms = RetrieveTargetPlatformList(diskRoots, extensionDiskRoots, registryRoot); @@ -583,7 +583,7 @@ namespace Microsoft.Build.Utilities [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "SDK", Justification = "Shipped this way in Dev11 Beta (go-live)")] public static string GetPlatformExtensionSDKLocation(string sdkMoniker, string targetPlatformIdentifier, string targetPlatformVersion, string diskRoots, string extensionDiskRoots, string registryRoot) { - ErrorUtilities.VerifyThrowArgumentNull(targetPlatformVersion, nameof(targetPlatformVersion)); + ErrorUtilities.VerifyThrowArgumentNull(targetPlatformVersion); string[] sdkDiskRoots = null; if (!string.IsNullOrEmpty(diskRoots)) @@ -1282,7 +1282,7 @@ namespace Microsoft.Build.Utilities [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "SDK", Justification = "Shipped this way in Dev11 Beta (go-live)")] public static string GetPlatformSDKLocation(string targetPlatformIdentifier, string targetPlatformVersion, string diskRoots, string registryRoot) { - ErrorUtilities.VerifyThrowArgumentNull(targetPlatformVersion, nameof(targetPlatformVersion)); + ErrorUtilities.VerifyThrowArgumentNull(targetPlatformVersion); string[] sdkDiskRoots = null; if (!string.IsNullOrEmpty(diskRoots)) @@ -1331,8 +1331,8 @@ namespace Microsoft.Build.Utilities /// A list of keys for the installed platforms for the given SDK public static IEnumerable GetPlatformsForSDK(string sdkIdentifier, Version sdkVersion, string[] diskRoots, string registryRoot) { - ErrorUtilities.VerifyThrowArgumentNull(sdkIdentifier, nameof(sdkIdentifier)); - ErrorUtilities.VerifyThrowArgumentNull(sdkVersion, nameof(sdkVersion)); + ErrorUtilities.VerifyThrowArgumentNull(sdkIdentifier); + ErrorUtilities.VerifyThrowArgumentNull(sdkVersion); IEnumerable targetPlatformSDKs = RetrieveTargetPlatformList(diskRoots, null, registryRoot); @@ -1370,8 +1370,8 @@ namespace Microsoft.Build.Utilities /// The latest installed version for the given SDK public static string GetLatestSDKTargetPlatformVersion(string sdkIdentifier, string sdkVersion, string[] sdkRoots) { - ErrorUtilities.VerifyThrowArgumentNull(sdkIdentifier, nameof(sdkIdentifier)); - ErrorUtilities.VerifyThrowArgumentNull(sdkVersion, nameof(sdkVersion)); + ErrorUtilities.VerifyThrowArgumentNull(sdkIdentifier); + ErrorUtilities.VerifyThrowArgumentNull(sdkVersion); var availablePlatformVersions = new List(); IEnumerable platformMonikerList = GetPlatformsForSDK(sdkIdentifier, new Version(sdkVersion), sdkRoots, null); @@ -1554,7 +1554,7 @@ namespace Microsoft.Build.Utilities /// private static TargetPlatformSDK GetMatchingPlatformSDK(string targetPlatformIdentifier, string targetPlatformVersion, string diskRoots, string multiPlatformDiskRoots, string registryRoot) { - ErrorUtilities.VerifyThrowArgumentNull(targetPlatformVersion, nameof(targetPlatformVersion)); + ErrorUtilities.VerifyThrowArgumentNull(targetPlatformVersion); string[] sdkDiskRoots = null; if (!string.IsNullOrEmpty(diskRoots)) @@ -1583,7 +1583,7 @@ namespace Microsoft.Build.Utilities private static TargetPlatformSDK GetMatchingPlatformSDK(string targetPlatformIdentifier, Version targetPlatformVersion, string[] diskRoots, string[] multiPlatformDiskRoots, string registryRoot) { ErrorUtilities.VerifyThrowArgumentLength(targetPlatformIdentifier, nameof(targetPlatformIdentifier)); - ErrorUtilities.VerifyThrowArgumentNull(targetPlatformVersion, nameof(targetPlatformVersion)); + ErrorUtilities.VerifyThrowArgumentNull(targetPlatformVersion); IEnumerable targetPlatforms = RetrieveTargetPlatformList(diskRoots, multiPlatformDiskRoots, registryRoot); @@ -1913,7 +1913,7 @@ namespace Microsoft.Build.Utilities { ErrorUtilities.VerifyThrowArgumentLength(targetFrameworkVersion, nameof(targetFrameworkVersion)); ErrorUtilities.VerifyThrowArgumentLength(targetFrameworkIdentifier, nameof(targetFrameworkIdentifier)); - ErrorUtilities.VerifyThrowArgumentNull(targetFrameworkProfile, nameof(targetFrameworkProfile)); + ErrorUtilities.VerifyThrowArgumentNull(targetFrameworkProfile); Version frameworkVersion = ConvertTargetFrameworkVersionToVersion(targetFrameworkVersion); FrameworkNameVersioning targetFrameworkName = new FrameworkNameVersioning(targetFrameworkIdentifier, frameworkVersion, targetFrameworkProfile); @@ -1933,7 +1933,7 @@ namespace Microsoft.Build.Utilities public static IList GetPathToReferenceAssemblies(FrameworkNameVersioning frameworkName) { // Verify the framework class passed in is not null. Other than being null the class will ensure the framework moniker is correct - ErrorUtilities.VerifyThrowArgumentNull(frameworkName, nameof(frameworkName)); + ErrorUtilities.VerifyThrowArgumentNull(frameworkName); IList paths = GetPathToReferenceAssemblies( FrameworkLocationHelper.programFilesReferenceAssemblyLocation, @@ -2213,7 +2213,7 @@ namespace Microsoft.Build.Utilities // 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)); // 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, nameof(frameworkName)); + ErrorUtilities.VerifyThrowArgumentNull(frameworkName); string referenceAssemblyCacheKey = GenerateReferenceAssemblyCacheKey(targetFrameworkRootPath, frameworkName); CreateReferenceAssemblyPathsCache(); diff --git a/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs b/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs index fad06ee59a..170713d7f9 100644 --- a/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs +++ b/src/Utilities/TrackedDependencies/CanonicalTrackedOutputFiles.cs @@ -272,7 +272,7 @@ namespace Microsoft.Build.Utilities /// An array of the rooting markers that were removed. public string[] RemoveRootsWithSharedOutputs(ITaskItem[] sources) { - ErrorUtilities.VerifyThrowArgumentNull(sources, nameof(sources)); + ErrorUtilities.VerifyThrowArgumentNull(sources); var removedMarkers = new List(); string currentRoot = FileTracker.FormatRootingMarker(sources); diff --git a/src/Utilities/TrackedDependencies/FileTracker.cs b/src/Utilities/TrackedDependencies/FileTracker.cs index f3db3169e4..ef175ad916 100644 --- a/src/Utilities/TrackedDependencies/FileTracker.cs +++ b/src/Utilities/TrackedDependencies/FileTracker.cs @@ -310,7 +310,7 @@ namespace Microsoft.Build.Utilities /// ITaskItem array of outputs. public static string FormatRootingMarker(ITaskItem[] sources, ITaskItem[] outputs) { - ErrorUtilities.VerifyThrowArgumentNull(sources, nameof(sources)); + ErrorUtilities.VerifyThrowArgumentNull(sources); // So we don't have to deal with null checks. outputs ??= Array.Empty(); @@ -729,7 +729,7 @@ namespace Microsoft.Build.Utilities // Only log when we have been passed a TaskLoggingHelper if (Log != null) { - ErrorUtilities.VerifyThrowArgumentNull(messageResourceName, nameof(messageResourceName)); + ErrorUtilities.VerifyThrowArgumentNull(messageResourceName); Log.LogMessage(importance, AssemblyResources.GetString(messageResourceName), messageArgs); }