-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix some error messages in dotnet test #50393
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
Conversation
There was a problem hiding this 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 fixes error messages in the dotnet CLI by adding a new localized string TestCommandExceptionUnableToRun and updating the error handling logic for test command execution. The changes improve error messaging consistency between run and test commands.
- Adds a new localized error message specifically for test command execution failures
- Updates error handling logic to use the correct error message for test scenarios
- Refactors run properties handling to separate test platform applications from VSTest projects
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Cli/dotnet/Commands/CliCommandStrings.resx | Adds new TestCommandExceptionUnableToRun error message string |
| src/Cli/dotnet/Commands/xlf/*.xlf | Auto-generated localization files with new error message translations |
| src/Cli/dotnet/Commands/Test/SolutionAndProjectUtility.cs | Updates error handling to use test-specific error message and improves run properties logic |
| src/Cli/dotnet/Commands/Run/RunProperties.cs | Refactors to extract common error handling logic and use appropriate error messages |
|
/backport to release/10.0.1xx |
|
Started backporting to release/10.0.1xx: https://github.com/dotnet/sdk/actions/runs/17127212696 |
This pull request improves error handling and messaging for the
dotnet testcommand, especially when a project is not runnable or is misconfigured. It introduces a new error message for test command failures, refactors how run properties are retrieved, and ensures consistency in error reporting across different scenarios. Additionally, translations for the new error message have been added for multiple languages.Error handling and messaging improvements:
TestCommandExceptionUnableToRunfor cases wheredotnet testcannot proceed due to project misconfiguration, including details about the project, command, property, and current value. This message is now used instead of the generic run error in test scenarios. [1] [2]TestCommandExceptionUnableToRunin all supported languages, ensuring consistent messaging for global users. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]Code refactoring and logic changes:
RunProperties.GetPropsFromProjectandRunProperties.ThrowUnableToRunErrormethods to centralize and clarify how run properties and related errors are handled for test projects.SolutionAndProjectUtilitylogic to only retrieve run properties for platform test applications and to create minimal run properties for VSTest projects, improving robustness and clarity. [1] [2]GetPropsFromProjectmethod instead of the previousFromProjectmethod, aligning with the new error handling flow.