Skip to content

Commit 5e273cc

Browse files
authored
Fix bug with not passing scheduled node id to the task host task (#12639)
### Context There seem to be a merge bug introduced in #12577. The scheduled node id should be passed to the `TaskHostTask` in both instances of the task creation. ### Changes Made 1. Passed scheduled node id to the task host task constructor 2. Removed the default value in constructor to avoid such errors in future. ### Testing None
1 parent ce41c05 commit 5e273cc

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ private ITask InstantiateTask(int scheduledNodeId, IDictionary<string, string> t
10031003
return null;
10041004
}
10051005

1006-
task = CreateTaskHostTaskForOutOfProcFactory(taskIdentityParameters, taskFactoryEngineContext, outOfProcTaskFactory);
1006+
task = CreateTaskHostTaskForOutOfProcFactory(taskIdentityParameters, taskFactoryEngineContext, outOfProcTaskFactory, scheduledNodeId);
10071007
isTaskHost = true;
10081008
}
10091009
else
@@ -1740,8 +1740,13 @@ private void DisplayCancelWaitMessage()
17401740
/// <param name="taskIdentityParameters">Task identity parameters.</param>
17411741
/// <param name="taskFactoryEngineContext">The engine context to use for the task.</param>
17421742
/// <param name="outOfProcTaskFactory">The out-of-process task factory instance.</param>
1743+
/// <param name="scheduledNodeId">Node for which the task host should be called</param>
17431744
/// <returns>A TaskHostTask that will execute the inner task out of process, or <code>null</code> if task creation fails.</returns>
1744-
private ITask CreateTaskHostTaskForOutOfProcFactory(IDictionary<string, string> taskIdentityParameters, TaskFactoryEngineContext taskFactoryEngineContext, IOutOfProcTaskFactory outOfProcTaskFactory)
1745+
private ITask CreateTaskHostTaskForOutOfProcFactory(
1746+
IDictionary<string, string> taskIdentityParameters,
1747+
TaskFactoryEngineContext taskFactoryEngineContext,
1748+
IOutOfProcTaskFactory outOfProcTaskFactory,
1749+
int scheduledNodeId)
17451750
{
17461751
ITask innerTask;
17471752

@@ -1791,19 +1796,17 @@ private ITask CreateTaskHostTaskForOutOfProcFactory(IDictionary<string, string>
17911796
// Clean up the original task since we're going to wrap it
17921797
_taskFactoryWrapper.TaskFactory.CleanupTask(innerTask);
17931798

1794-
#pragma warning disable SA1111, SA1009 // Closing parenthesis should be on line of last parameter
17951799
return new TaskHostTask(
17961800
_taskLocation,
17971801
_taskLoggingContext,
17981802
_buildComponentHost,
17991803
taskHostParameters,
18001804
taskLoadedType,
1801-
true
1805+
true,
18021806
#if FEATURE_APPDOMAIN
1803-
, AppDomainSetup
1807+
AppDomainSetup,
18041808
#endif
1805-
);
1806-
#pragma warning restore SA1111, SA1009 // Closing parenthesis should be on line of last parameter
1809+
scheduledNodeId);
18071810
}
18081811
}
18091812
}

src/Build/Instance/TaskFactories/AssemblyTaskFactory.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@ internal ITask CreateTaskInstance(
389389
AddNetHostParams(ref mergedParameters, getProperty);
390390
}
391391

392-
#pragma warning disable SA1111, SA1009 // Closing parenthesis should be on line of last parameter
393392
TaskHostTask task = new TaskHostTask(
394393
taskLocation,
395394
taskLoggingContext,

src/Build/Instance/TaskFactories/TaskHostTask.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public TaskHostTask(
159159
#if FEATURE_APPDOMAIN
160160
AppDomainSetup appDomainSetup,
161161
#endif
162-
int scheduledNodeId = -1)
162+
int scheduledNodeId)
163163
{
164164
ErrorUtilities.VerifyThrowInternalNull(taskType);
165165

0 commit comments

Comments
 (0)