Skip to content

Conversation

jjonescz
Copy link
Member

Fixes #50778.

@jjonescz jjonescz added the Area-run-file Items related to the "dotnet run <file>" effort label Sep 12, 2025
@jjonescz jjonescz marked this pull request as ready for review September 12, 2025 12:13
@jjonescz jjonescz requested review from a team and Copilot September 12, 2025 12:13
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

Fixes an issue where file-based C# apps were not properly passing command-line arguments when using the CSC optimization path. The PR ensures that when dotnet run uses the direct CSC compilation approach for file-based apps, the application arguments are correctly forwarded to the executed program.

  • Modifies the CreateCommandForCscBuiltProgram method to accept and properly escape application arguments
  • Updates the method call site to pass the ApplicationArgs parameter
  • Adds comprehensive test coverage for the CSC-only path with arguments

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Cli/dotnet/Commands/Run/RunCommand.cs Updates CSC optimization path to properly handle application arguments
test/dotnet.Tests/CommandTests/Run/RunFileTests.cs Adds test cases to verify argument passing works correctly in CSC-only scenarios

@RikkiGibson RikkiGibson self-assigned this Sep 12, 2025
@jjonescz jjonescz requested review from 333fred and MiYanni September 13, 2025 09:30
@jjonescz
Copy link
Member Author

@333fred @MiYanni for reviews, thanks

@jjonescz
Copy link
Member Author

@333fred for a review of a simple change, thanks

var programPath = Path.Join(testInstance.Path, "Program.cs");

var code = $"""
#:property Configuration=Release
Copy link
Member

@333fred 333fred Sep 17, 2025

Choose a reason for hiding this comment

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

What's the purpose of this flag in this test?

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.

4 participants