Skip to content

Remove bad assert #48922

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 1 commit into from
May 13, 2025
Merged

Remove bad assert #48922

merged 1 commit into from
May 13, 2025

Conversation

Forgind
Copy link
Contributor

@Forgind Forgind commented May 13, 2025

File.Exists just returns false if its input is null, and asserting that it shouldn't be null means that if dotnet.config isn't found (which should be very common), anyone using debug bits will be unable to run any dotnet command. (Commands are all initialized before any commands are executed.)

This just removes the unnecessary assert added in #48846.

@Copilot Copilot AI review requested due to automatic review settings May 13, 2025 20:04
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 removes an unnecessary Debug.Assert that could lead to issues when the dotnet.config file is missing.

  • Removed assertion on dotnetConfigPath being non-null to allow File.Exists to handle null inputs.

Copy link
Member

@joeloff joeloff left a comment

Choose a reason for hiding this comment

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

Random question, why is this under the CLI and not under the test folder?

@Forgind
Copy link
Contributor Author

Forgind commented May 13, 2025

Random question, why is this under the CLI and not under the test folder?

Well, for the precise answer, we'd have to ask the bot. I'd say it kinda fits under either? It's the CLI for the test command...

@Forgind Forgind enabled auto-merge (squash) May 13, 2025 20:10
@baronfel
Copy link
Member

baronfel commented May 13, 2025

good point - we should push this kind of discovery into the command execution not command definition.

@Forgind
Copy link
Contributor Author

Forgind commented May 13, 2025

good point - we should push this kind of discovery into the command execution not command definition.

From an architectural perspective, I think you're right. It'd be more logical as well as more performant for anyone not making running dotnet test. I tried to make the smallest change that would accomplish my goal, but I can make an issue to move it there.

@joeloff
Copy link
Member

joeloff commented May 13, 2025

Random question, why is this under the CLI and not under the test folder?

Well, for the precise answer, we'd have to ask the bot. I'd say it kinda fits under either? It's the CLI for the test command...

sorry, blanked for a moment, I was confusing this with tests for CLI commands, not the dotnet test command

@nagilson
Copy link
Member

Yes, thank you so much, this was confusing me today 👏

@Forgind Forgind merged commit b3d69dd into dotnet:main May 13, 2025
31 checks passed
@Forgind Forgind deleted the remove-debug-assert branch May 13, 2025 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants