Skip to content

Fix and test more dotnet file precedence cases #49510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 20, 2025

Conversation

jjonescz
Copy link
Member

Follow up on #49485.

@jjonescz jjonescz added the Area-run-file Items related to the "dotnet run <file>" effort label Jun 20, 2025
@jjonescz jjonescz marked this pull request as ready for review June 20, 2025 13:18
@jjonescz jjonescz requested review from a team and Copilot June 20, 2025 13:18
Copy link
Contributor

@Copilot 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 enhances the dotnet command precedence handling by introducing additional test cases and refactoring key command resolution logic.

  • Added tests to ensure proper precedence between built-in, file-based, and NuGet tool invocations.
  • Refactored Program.cs to extract file-based app resolution and built-in command invocation into dedicated helper methods.
  • Updated CommandFactoryUsingResolver.cs to consistently use a CreateOrThrow method for command creation.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
test/dotnet.Tests/CommandTests/Run/RunFileTests.cs Adds tests for file-based app precedence cases and NuGet tool scenarios
src/Cli/dotnet/Program.cs Refactors command invocation logic by extracting helper methods
src/Cli/dotnet/CommandFactory/CommandFactoryUsingResolver.cs Adjusts command creation using a new CreateOrThrow method
Comments suppressed due to low confidence (1)

src/Cli/dotnet/Program.cs:285

  • [nitpick] Consider adding XML documentation comments for the new helper methods 'TryRunFileBasedApp' and 'InvokeBuiltInCommand' to provide clarity on their usage and behavior.
        static int? TryRunFileBasedApp(ParseResult parseResult)

Copy link
Member

@baronfel baronfel left a comment

Choose a reason for hiding this comment

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

Nice! Thanks for also taking care of the dotnet-<tool> invocation pattern while you were here!

@baronfel baronfel merged commit acbb547 into dotnet:main Jun 20, 2025
30 checks passed
@jjonescz jjonescz deleted the dotnet-norun-noext branch June 23, 2025 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-run-file Items related to the "dotnet run <file>" effort
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants