Skip to content

Port https://github.com/dotnet/dotnet/pull/4642/changes#53194

Merged
marcpopMSFT merged 1 commit intorelease/11.0.1xx-preview2from
marcpopMSFT-patch-3
Mar 2, 2026
Merged

Port https://github.com/dotnet/dotnet/pull/4642/changes#53194
marcpopMSFT merged 1 commit intorelease/11.0.1xx-preview2from
marcpopMSFT-patch-3

Conversation

@marcpopMSFT
Copy link
Member

Fixes #52819

The fix was made in the 2xx VMR and it has flowed back to the SDK and into 3xx but it's still stuck going to main so missed the preview 2 snap.

Fixes #52819

The fix was made in the 2xx VMR and it has flowed back to the SDK and into 3xx but it's still stuck going to main so missed the preview 2 snap.
Copilot AI review requested due to automatic review settings February 27, 2026 22:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ports a fix from the 2xx VMR branch (dotnet/dotnet#4642) to the main branch of the SDK. It resolves issue #52819, where running dnx <tool> would throw an InvalidCastException because ToolExecuteCommand was typed to CommandBase<ToolExecuteCommandDefinition>, but when invoked via the dnx command alias the actual parsed command object is a DnxCommandDefinition (which inherits from ToolExecuteCommandDefinitionBase, not from ToolExecuteCommandDefinition). The fix widens the type parameter constraint to the shared base class, enabling both dnx and dotnet tool execute to share the same handler.

Changes:

  • ToolExecuteCommand now extends CommandBase<ToolExecuteCommandDefinitionBase> instead of CommandBase<ToolExecuteCommandDefinition>, fixing the invalid cast when invoked via dnx.

@marcpopMSFT
Copy link
Member Author

/ba-g unrelated failures

@marcpopMSFT marcpopMSFT merged commit d6def13 into release/11.0.1xx-preview2 Mar 2, 2026
27 of 29 checks passed
@marcpopMSFT marcpopMSFT deleted the marcpopMSFT-patch-3 branch March 2, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants