Skip to content

Commit

Permalink
Add result for target stop event trace (#11202)
Browse files Browse the repository at this point in the history
Fixes #10975

Context
The stop events didn't report success or failure.

Changes Made
Pass parameter currentTargetEntry.Result.ResultCode.ToString() to the event log
  • Loading branch information
JaynieBai authored Jan 6, 2025
1 parent 89b8461 commit bc0bd0a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ private async Task ProcessTargetStack(ITaskBuilder taskBuilder)
// Execute all of the tasks on this target.
MSBuildEventSource.Log.TargetStart(currentTargetEntry.Name);
await currentTargetEntry.ExecuteTarget(taskBuilder, _requestEntry, _projectLoggingContext, _cancellationToken);
MSBuildEventSource.Log.TargetStop(currentTargetEntry.Name);
MSBuildEventSource.Log.TargetStop(currentTargetEntry.Name, currentTargetEntry.Result?.ResultCode.ToString() ?? string.Empty);
}

break;
Expand Down
7 changes: 4 additions & 3 deletions src/Framework/MSBuildEventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,11 @@ public void TargetStart(string targetName)
}

/// <param name="targetName">The name of the target being executed.</param>
[Event(44, Keywords = Keywords.All | Keywords.PerformanceLog)]
public void TargetStop(string targetName)
/// <param name="result">Target stop result.</param>
[Event(44, Keywords = Keywords.All | Keywords.PerformanceLog, Version = 1)]
public void TargetStop(string targetName, string result)
{
WriteEvent(44, targetName);
WriteEvent(44, targetName, result);
}

/// <summary>
Expand Down

0 comments on commit bc0bd0a

Please sign in to comment.