Skip to content

Commit

Permalink
Regex update CallerArgument pattern
Browse files Browse the repository at this point in the history
From

```
ErrorUtilities\.VerifyThrowInternalNull\(([a-zA-Z0-9]+), nameof\(\1\)\);
```

to

```
ErrorUtilities.VerifyThrowInternalNull($1);
```

and revert `src/Deprecated`.
  • Loading branch information
rainersigwald committed Oct 14, 2024
1 parent 0e3e4f5 commit 96592c8
Show file tree
Hide file tree
Showing 51 changed files with 119 additions and 119 deletions.
2 changes: 1 addition & 1 deletion src/Build/BackEnd/BuildManager/BuildManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3163,7 +3163,7 @@ private bool ReuseOldCaches(string[] inputCacheFiles)
{
Debug.Assert(Monitor.IsEntered(_syncLock));

ErrorUtilities.VerifyThrowInternalNull(inputCacheFiles, nameof(inputCacheFiles));
ErrorUtilities.VerifyThrowInternalNull(inputCacheFiles);
ErrorUtilities.VerifyThrow(_configCache == null, "caches must not be set at this point");
ErrorUtilities.VerifyThrow(_resultsCache == null, "caches must not be set at this point");

Expand Down
2 changes: 1 addition & 1 deletion src/Build/BackEnd/BuildManager/BuildParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ private BuildParameters(ITranslator translator)
/// </summary>
internal BuildParameters(BuildParameters other, bool resetEnvironment = false)
{
ErrorUtilities.VerifyThrowInternalNull(other, nameof(other));
ErrorUtilities.VerifyThrowInternalNull(other);

_buildId = other._buildId;
_culture = other._culture;
Expand Down
4 changes: 2 additions & 2 deletions src/Build/BackEnd/BuildManager/CacheAggregator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public CacheAggregator(Func<int> nextConfigurationId)

public void Add(IConfigCache configCache, IResultsCache resultsCache)
{
ErrorUtilities.VerifyThrowInternalNull(configCache, nameof(configCache));
ErrorUtilities.VerifyThrowInternalNull(resultsCache, nameof(resultsCache));
ErrorUtilities.VerifyThrowInternalNull(configCache);
ErrorUtilities.VerifyThrowInternalNull(resultsCache);
ErrorUtilities.VerifyThrow(!_aggregated, "Cannot add after aggregation");

_inputCaches.Add((configCache, resultsCache));
Expand Down
6 changes: 3 additions & 3 deletions src/Build/BackEnd/BuildManager/CacheSerialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static string SerializeCaches(
string outputCacheFile,
ProjectIsolationMode projectIsolationMode)
{
ErrorUtilities.VerifyThrowInternalNull(outputCacheFile, nameof(outputCacheFile));
ErrorUtilities.VerifyThrowInternalNull(outputCacheFile);

try
{
Expand Down Expand Up @@ -127,8 +127,8 @@ public static (IConfigCache ConfigCache, IResultsCache ResultsCache, Exception e
translator.Translate(ref resultsCache);
}

ErrorUtilities.VerifyThrowInternalNull(configCache, nameof(configCache));
ErrorUtilities.VerifyThrowInternalNull(resultsCache, nameof(resultsCache));
ErrorUtilities.VerifyThrowInternalNull(configCache);
ErrorUtilities.VerifyThrowInternalNull(resultsCache);

return (configCache, resultsCache, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public LinkStatus LinkStatus
/// <param name="factory">Unused</param>
public void Listen(INodePacketFactory factory)
{
ErrorUtilities.VerifyThrowInternalNull(factory, nameof(factory));
ErrorUtilities.VerifyThrowInternalNull(factory);
_packetFactory = factory;

// Initialize our thread in async mode so we are ready when the Node-side endpoint "connects".
Expand All @@ -180,7 +180,7 @@ public void Listen(INodePacketFactory factory)
/// <param name="factory">Unused</param>
public void Connect(INodePacketFactory factory)
{
ErrorUtilities.VerifyThrowInternalNull(factory, nameof(factory));
ErrorUtilities.VerifyThrowInternalNull(factory);
_packetFactory = factory;

// Set up asynchronous packet pump, if necessary.
Expand Down
4 changes: 2 additions & 2 deletions src/Build/BackEnd/Components/RequestBuilder/Lookup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ internal class Lookup : IPropertyProvider<ProjectPropertyInstance>, IItemProvide
/// </summary>
internal Lookup(IItemDictionary<ProjectItemInstance> projectItems, PropertyDictionary<ProjectPropertyInstance> properties)
{
ErrorUtilities.VerifyThrowInternalNull(projectItems, nameof(projectItems));
ErrorUtilities.VerifyThrowInternalNull(properties, nameof(properties));
ErrorUtilities.VerifyThrowInternalNull(projectItems);
ErrorUtilities.VerifyThrowInternalNull(properties);

Lookup.Scope scope = new Lookup.Scope(this, "Lookup()", projectItems, properties);
_lookupScopes.AddFirst(scope);
Expand Down
2 changes: 1 addition & 1 deletion src/Build/BackEnd/Components/RequestBuilder/TaskHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public TaskHost(IBuildComponentHost host, BuildRequestEntry requestEntry, Elemen
{
ErrorUtilities.VerifyThrowArgumentNull(host);
ErrorUtilities.VerifyThrowArgumentNull(requestEntry);
ErrorUtilities.VerifyThrowInternalNull(taskLocation, nameof(taskLocation));
ErrorUtilities.VerifyThrowInternalNull(taskLocation);

_host = host;
_requestEntry = requestEntry;
Expand Down
2 changes: 1 addition & 1 deletion src/Build/BackEnd/Components/Scheduler/Scheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2033,7 +2033,7 @@ BuildEventContext NewBuildEventContext()
SchedulableRequest parentRequest = _schedulingData.BlockedRequests.FirstOrDefault(r => r.BuildRequest.GlobalRequestId == request.ParentGlobalRequestId)
?? _schedulingData.ExecutingRequests.FirstOrDefault(r => r.BuildRequest.GlobalRequestId == request.ParentGlobalRequestId);

ErrorUtilities.VerifyThrowInternalNull(parentRequest, nameof(parentRequest));
ErrorUtilities.VerifyThrowInternalNull(parentRequest);
ErrorUtilities.VerifyThrow(
configCache.HasConfiguration(parentRequest.BuildRequest.ConfigurationId),
"All non root requests should have a parent with a loaded configuration");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ public override void PacketReceived(int node, INodePacket packet)
/// <inheritdoc cref="ISdkResolverService.ResolveSdk"/>
public override SdkResult ResolveSdk(int submissionId, SdkReference sdk, LoggingContext loggingContext, ElementLocation sdkReferenceLocation, string solutionPath, string projectPath, bool interactive, bool isRunningInVisualStudio, bool failOnUnresolvedSdk)
{
ErrorUtilities.VerifyThrowInternalNull(sdk, nameof(sdk));
ErrorUtilities.VerifyThrowInternalNull(loggingContext, nameof(loggingContext));
ErrorUtilities.VerifyThrowInternalNull(sdkReferenceLocation, nameof(sdkReferenceLocation));
ErrorUtilities.VerifyThrowInternalNull(sdk);
ErrorUtilities.VerifyThrowInternalNull(loggingContext);
ErrorUtilities.VerifyThrowInternalNull(sdkReferenceLocation);
ErrorUtilities.VerifyThrowInternalLength(projectPath, nameof(projectPath));

return _cachedSdkResolver.ResolveSdk(submissionId, sdk, loggingContext, sdkReferenceLocation, solutionPath, projectPath, interactive, isRunningInVisualStudio, failOnUnresolvedSdk);
Expand Down
2 changes: 1 addition & 1 deletion src/Build/BackEnd/Node/ServerNodeBuildCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public ServerNodeBuildCommand(
TargetConsoleConfiguration consoleConfiguration,
PartialBuildTelemetry? partialBuildTelemetry)
{
ErrorUtilities.VerifyThrowInternalNull(consoleConfiguration, nameof(consoleConfiguration));
ErrorUtilities.VerifyThrowInternalNull(consoleConfiguration);

_commandLine = commandLine;
_startupDirectory = startupDirectory;
Expand Down
2 changes: 1 addition & 1 deletion src/Build/BackEnd/Shared/BuildRequestConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ public void RetrieveFromCache()

public bool ShouldSkipIsolationConstraintsForReference(string referenceFullPath)
{
ErrorUtilities.VerifyThrowInternalNull(Project, nameof(Project));
ErrorUtilities.VerifyThrowInternalNull(Project);
ErrorUtilities.VerifyThrowInternalLength(referenceFullPath, nameof(referenceFullPath));
ErrorUtilities.VerifyThrow(Path.IsPathRooted(referenceFullPath), "Method does not treat path normalization cases");

Expand Down
16 changes: 8 additions & 8 deletions src/Build/BackEnd/Shared/EventsCreatorHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ internal static class EventsCreatorHelper
{
public static BuildMessageEventArgs CreateMessageEventFromText(BuildEventContext buildEventContext, MessageImportance importance, string message, params object?[]? messageArgs)
{
ErrorUtilities.VerifyThrowInternalNull(buildEventContext, nameof(buildEventContext));
ErrorUtilities.VerifyThrowInternalNull(message, nameof(message));
ErrorUtilities.VerifyThrowInternalNull(buildEventContext);
ErrorUtilities.VerifyThrowInternalNull(message);

BuildMessageEventArgs buildEvent = new BuildMessageEventArgs(
message,
Expand All @@ -32,9 +32,9 @@ public static BuildMessageEventArgs CreateMessageEventFromText(BuildEventContext

public static BuildErrorEventArgs CreateErrorEventFromText(BuildEventContext buildEventContext, string? subcategoryResourceName, string? errorCode, string? helpKeyword, BuildEventFileInfo file, string message)
{
ErrorUtilities.VerifyThrowInternalNull(buildEventContext, nameof(buildEventContext));
ErrorUtilities.VerifyThrowInternalNull(file, nameof(file));
ErrorUtilities.VerifyThrowInternalNull(message, nameof(message));
ErrorUtilities.VerifyThrowInternalNull(buildEventContext);
ErrorUtilities.VerifyThrowInternalNull(file);
ErrorUtilities.VerifyThrowInternalNull(message);

string? subcategory = null;

Expand Down Expand Up @@ -63,9 +63,9 @@ public static BuildErrorEventArgs CreateErrorEventFromText(BuildEventContext bui

public static BuildWarningEventArgs CreateWarningEventFromText(BuildEventContext buildEventContext, string? subcategoryResourceName, string? errorCode, string? helpKeyword, BuildEventFileInfo file, string message)
{
ErrorUtilities.VerifyThrowInternalNull(buildEventContext, nameof(buildEventContext));
ErrorUtilities.VerifyThrowInternalNull(file, nameof(file));
ErrorUtilities.VerifyThrowInternalNull(message, nameof(message));
ErrorUtilities.VerifyThrowInternalNull(buildEventContext);
ErrorUtilities.VerifyThrowInternalNull(file);
ErrorUtilities.VerifyThrowInternalNull(message);

string? subcategory = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public CheckDispatchingContext(

public void DispatchBuildEvent(BuildEventArgs buildEvent)
{
ErrorUtilities.VerifyThrowInternalNull(buildEvent, nameof(buildEvent));
ErrorUtilities.VerifyThrowInternalNull(buildEvent);

_eventDispatcher.Dispatch(buildEvent);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Build/Construction/ProjectElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ private class WrapperForProjectRootElement : ProjectElementContainer
/// </summary>
internal WrapperForProjectRootElement(ProjectRootElement containingProject)
{
ErrorUtilities.VerifyThrowInternalNull(containingProject, nameof(containingProject));
ErrorUtilities.VerifyThrowInternalNull(containingProject);
ContainingProject = containingProject;
}

Expand Down
10 changes: 5 additions & 5 deletions src/Build/Definition/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1805,7 +1805,7 @@ internal void VerifyThrowInvalidOperationNotZombie()
/// </summary>
internal void VerifyThrowInvalidOperationNotImported(ProjectRootElement otherXml)
{
ErrorUtilities.VerifyThrowInternalNull(otherXml, nameof(otherXml));
ErrorUtilities.VerifyThrowInternalNull(otherXml);
ErrorUtilities.VerifyThrowInvalidOperation(ReferenceEquals(Xml, otherXml), "OM_CannotModifyEvaluatedObjectInImportedFile", otherXml.Location.File);
}

Expand Down Expand Up @@ -3581,7 +3581,7 @@ public override void Unload()
/// </summary>
internal void VerifyThrowInvalidOperationNotImported(ProjectRootElement otherXml)
{
ErrorUtilities.VerifyThrowInternalNull(otherXml, nameof(otherXml));
ErrorUtilities.VerifyThrowInternalNull(otherXml);
ErrorUtilities.VerifyThrowInvalidOperation(ReferenceEquals(Xml, otherXml), "OM_CannotModifyEvaluatedObjectInImportedFile", otherXml.Location.File);
}

Expand Down Expand Up @@ -4385,7 +4385,7 @@ public void AddItemIgnoringCondition(ProjectItem item)
/// </summary>
public void AddToAllEvaluatedPropertiesList(ProjectProperty property)
{
ErrorUtilities.VerifyThrowInternalNull(property, nameof(property));
ErrorUtilities.VerifyThrowInternalNull(property);
AllEvaluatedProperties.Add(property);
}

Expand All @@ -4397,7 +4397,7 @@ public void AddToAllEvaluatedPropertiesList(ProjectProperty property)
/// </summary>
public void AddToAllEvaluatedItemDefinitionMetadataList(ProjectMetadata itemDefinitionMetadatum)
{
ErrorUtilities.VerifyThrowInternalNull(itemDefinitionMetadatum, nameof(itemDefinitionMetadatum));
ErrorUtilities.VerifyThrowInternalNull(itemDefinitionMetadatum);
AllEvaluatedItemDefinitionMetadata.Add(itemDefinitionMetadatum);
}

Expand All @@ -4409,7 +4409,7 @@ public void AddToAllEvaluatedItemDefinitionMetadataList(ProjectMetadata itemDefi
/// </summary>
public void AddToAllEvaluatedItemsList(ProjectItem item)
{
ErrorUtilities.VerifyThrowInternalNull(item, nameof(item));
ErrorUtilities.VerifyThrowInternalNull(item);
AllEvaluatedItems.Add(item);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Build/Definition/ProjectItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ internal ProjectItem(
PropertyDictionary<ProjectMetadata> directMetadataCloned,
List<ProjectItemDefinition> inheritedItemDefinitionsCloned)
{
ErrorUtilities.VerifyThrowInternalNull(project, nameof(project));
ErrorUtilities.VerifyThrowInternalNull(project);
ErrorUtilities.VerifyThrowArgumentNull(xml);

// Orcas accidentally allowed empty includes if they resulted from expansion: we preserve that bug
Expand Down
2 changes: 1 addition & 1 deletion src/Build/Definition/ProjectItemDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class ProjectItemDefinition : IKeyed, IMetadataTable, IItemDefinition<Pro
/// </remarks>
internal ProjectItemDefinition(Project project, string itemType)
{
ErrorUtilities.VerifyThrowInternalNull(project, nameof(project));
ErrorUtilities.VerifyThrowInternalNull(project);
ErrorUtilities.VerifyThrowArgumentLength(itemType);

_project = project;
Expand Down
4 changes: 2 additions & 2 deletions src/Build/Definition/Toolset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ internal Toolset(
internal Toolset(string toolsVersion, string toolsPath, PropertyDictionary<ProjectPropertyInstance> buildProperties, ProjectCollection projectCollection, DirectoryGetFiles getFiles, LoadXmlFromPath loadXmlFromPath, string msbuildOverrideTasksPath, DirectoryExists directoryExists)
: this(toolsVersion, toolsPath, buildProperties, projectCollection.EnvironmentProperties, projectCollection.GlobalPropertiesCollection, null, msbuildOverrideTasksPath, null)
{
ErrorUtilities.VerifyThrowInternalNull(getFiles, nameof(getFiles));
ErrorUtilities.VerifyThrowInternalNull(loadXmlFromPath, nameof(loadXmlFromPath));
ErrorUtilities.VerifyThrowInternalNull(getFiles);
ErrorUtilities.VerifyThrowInternalNull(loadXmlFromPath);

_directoryExists = directoryExists;
_getFiles = getFiles;
Expand Down
2 changes: 1 addition & 1 deletion src/Build/Evaluation/Conditionals/Token.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ internal Token(TokenType type, string tokenString, bool expandable)
type == TokenType.Function,
"Unexpected token type");

ErrorUtilities.VerifyThrowInternalNull(tokenString, nameof(tokenString));
ErrorUtilities.VerifyThrowInternalNull(tokenString);

_tokenType = type;
_tokenString = tokenString;
Expand Down
10 changes: 5 additions & 5 deletions src/Build/Evaluation/Evaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@ private Evaluator(
ILoggingService loggingService,
BuildEventContext buildEventContext)
{
ErrorUtilities.VerifyThrowInternalNull(data, nameof(data));
ErrorUtilities.VerifyThrowInternalNull(projectRootElementCache, nameof(projectRootElementCache));
ErrorUtilities.VerifyThrowInternalNull(evaluationContext, nameof(evaluationContext));
ErrorUtilities.VerifyThrowInternalNull(loggingService, nameof(loggingService));
ErrorUtilities.VerifyThrowInternalNull(buildEventContext, nameof(buildEventContext));
ErrorUtilities.VerifyThrowInternalNull(data);
ErrorUtilities.VerifyThrowInternalNull(projectRootElementCache);
ErrorUtilities.VerifyThrowInternalNull(evaluationContext);
ErrorUtilities.VerifyThrowInternalNull(loggingService);
ErrorUtilities.VerifyThrowInternalNull(buildEventContext);

_evaluationLoggingContext = new EvaluationLoggingContext(
loggingService,
Expand Down
8 changes: 4 additions & 4 deletions src/Build/Evaluation/Expander.cs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ internal string ExpandIntoStringLeaveEscaped(string expression, ExpanderOptions
return String.Empty;
}

ErrorUtilities.VerifyThrowInternalNull(elementLocation, nameof(elementLocation));
ErrorUtilities.VerifyThrowInternalNull(elementLocation);

string result = MetadataExpander.ExpandMetadataLeaveEscaped(expression, _metadata, options, elementLocation, _loggingContext);
result = PropertyExpander<P>.ExpandPropertiesLeaveEscaped(result, _properties, options, elementLocation, _propertiesUseTracker, _fileSystem);
Expand All @@ -514,7 +514,7 @@ internal object ExpandPropertiesLeaveTypedAndEscaped(string expression, Expander
return String.Empty;
}

ErrorUtilities.VerifyThrowInternalNull(elementLocation, nameof(elementLocation));
ErrorUtilities.VerifyThrowInternalNull(elementLocation);

string metaExpanded = MetadataExpander.ExpandMetadataLeaveEscaped(expression, _metadata, options, elementLocation);
return PropertyExpander<P>.ExpandPropertiesLeaveTypedAndEscaped(metaExpanded, _properties, options, elementLocation, _propertiesUseTracker, _fileSystem);
Expand Down Expand Up @@ -562,7 +562,7 @@ internal IList<T> ExpandIntoItemsLeaveEscaped<T>(string expression, IItemFactory
return Array.Empty<T>();
}

ErrorUtilities.VerifyThrowInternalNull(elementLocation, nameof(elementLocation));
ErrorUtilities.VerifyThrowInternalNull(elementLocation);

expression = MetadataExpander.ExpandMetadataLeaveEscaped(expression, _metadata, options, elementLocation);
expression = PropertyExpander<P>.ExpandPropertiesLeaveEscaped(expression, _properties, options, elementLocation, _propertiesUseTracker, _fileSystem);
Expand Down Expand Up @@ -636,7 +636,7 @@ internal IList<T> ExpandSingleItemVectorExpressionIntoItems<T>(string expression
return Array.Empty<T>();
}

ErrorUtilities.VerifyThrowInternalNull(elementLocation, nameof(elementLocation));
ErrorUtilities.VerifyThrowInternalNull(elementLocation);

return ItemExpander.ExpandSingleItemVectorExpressionIntoItems(this, expression, _items, itemFactory, options, includeNullItems, out isTransformExpression, elementLocation);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Build/Evaluation/ProjectParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ internal class ProjectParser
/// </summary>
private ProjectParser(XmlDocumentWithLocation document, ProjectRootElement project)
{
ErrorUtilities.VerifyThrowInternalNull(project, nameof(project));
ErrorUtilities.VerifyThrowInternalNull(document, nameof(document));
ErrorUtilities.VerifyThrowInternalNull(project);
ErrorUtilities.VerifyThrowInternalNull(document);

_document = document;
_project = project;
Expand Down
4 changes: 2 additions & 2 deletions src/Build/Evaluation/PropertyTrackingEvaluatorDataWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ internal class PropertyTrackingEvaluatorDataWrapper<P, I, M, D> : IEvaluatorData
/// <param name="settingValue">Property tracking setting value</param>
public PropertyTrackingEvaluatorDataWrapper(IEvaluatorData<P, I, M, D> dataToWrap, EvaluationLoggingContext evaluationLoggingContext, int settingValue)
{
ErrorUtilities.VerifyThrowInternalNull(dataToWrap, nameof(dataToWrap));
ErrorUtilities.VerifyThrowInternalNull(evaluationLoggingContext, nameof(evaluationLoggingContext));
ErrorUtilities.VerifyThrowInternalNull(dataToWrap);
ErrorUtilities.VerifyThrowInternalNull(evaluationLoggingContext);

_wrapped = dataToWrap;
_evaluationLoggingContext = evaluationLoggingContext;
Expand Down
Loading

0 comments on commit 96592c8

Please sign in to comment.