Repository navigation
Remove internal keyword from TaskEnvironment setter in IMultiThreadableTask - #12848
Conversation
|
Hello @@copilot, I noticed that you’re changing an .swr file or any file under src/Package/MSBuild.VSSetup.. Please make sure to validate this change by an experimental VS insertion. This is accomplished by pushing to an exp/* branch, which requires write permissions to this repo. |
…leTask The internal keyword on the TaskEnvironment setter prevented external assemblies from implementing the IMultiThreadableTask interface since they don't have InternalsVisibleTo access. This change makes the interface implementable by SDK tasks and custom tasks in external assemblies. Co-authored-by: JanProvaznik <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical API design issue in the IMultiThreadableTask interface by removing the internal keyword from the TaskEnvironment property setter. The interface was previously unimplementable by external assemblies (SDK tasks, custom tasks) without InternalsVisibleTo access, which defeated the purpose of having a public interface.
Key Changes:
- Changed
TaskEnvironmentproperty setter frominternal settopublic setinIMultiThreadableTaskinterface - Aligns with the established MSBuild pattern used in
ITaskinterface where engine-set properties have public setters - Documentation already clearly states the property "should never be set by a Task itself", relying on documentation as the enforcement mechanism
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
Fixes #
Context
The
internal setaccessor onIMultiThreadableTask.TaskEnvironmentmakes the interface unimplementable by external assemblies (SDK tasks, custom tasks) that don't haveInternalsVisibleToaccess.Changes Made
internalkeyword from theTaskEnvironmentsetter inIMultiThreadableTask.csThe documented contract ("should never be set by a Task itself") remains as the enforcement mechanism, which is the standard pattern for interfaces meant to be implemented externally.
Testing
Notes
None.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
dnceng.pkgs.visualstudio.com/home/REDACTED/work/msbuild/msbuild/artifacts/bin/bootstrap/core/dotnet dotnet test src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj --filter FullyQualifiedName~TaskRouter --no-build -v m(dns block)/home/REDACTED/work/msbuild/msbuild/artifacts/bin/bootstrap/core/dotnet dotnet test src/Framework.UnitTests/Microsoft.Build.Framework.UnitTests.csproj --no-build -v m(dns block)/home/REDACTED/work/msbuild/msbuild/artifacts/bin/bootstrap/core/dotnet dotnet build src/Samples/Dependency/Dependency.csproj(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.