-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Remove bad assert #48922
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 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.
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.
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... |
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. |
sorry, blanked for a moment, I was confusing this with tests for CLI commands, not the |
Yes, thank you so much, this was confusing me today 👏 |
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.