dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.16k stars 1.34k forks source link

Expose ToolTask exit, stdout, and stderr handlers #10148

Closed ladipro closed 1 month ago

ladipro commented 1 month ago

Context

The StartToolProcess method added in #9649 does not allow subclasses to create and return equivalent processes because it does not have access to the exit, stdout, and stderr event handlers subscribed in the incoming Process object. In C# it is not possible to get the invocation list of an event outside of its declaring class.

Changes Made

Made ReceiveExitNotification, ReceiveStandardErrorData, and ReceiveStandardOutputData protected to expose them to subclasses.

Testing

A new unit test exercising the scenario.