Skip to content
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

Require implicit restore for commands that require restore #14119

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Nigusu-Allehu
Copy link
Contributor

@Nigusu-Allehu Nigusu-Allehu commented Feb 20, 2025

@Nigusu-Allehu Nigusu-Allehu requested a review from a team as a code owner February 20, 2025 17:58
@Nigusu-Allehu Nigusu-Allehu self-assigned this Feb 20, 2025
3. **Handle scenarios where restore is unsuccessful**
- If implicit restore fails due to network issues, package source unavailability, or conflicting dependencies, the command should fail with a clear error message.
- If `--no-restore` is specified and the assets file is missing or outdated, the command should either:
- Proceed with a warning that the results may be inaccurate.
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this is missing other options. I think we should detect if restore is out-of-date and log a warning if the user specified --no-restore.

Copy link
Member

Choose a reason for hiding this comment

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

tbh, I wouldn't mess with the outdated check.
The rest of the implicit commands also don't mess with it.
If you skip the implicit command, we should just assume it's correct until we have a good reason to make it more costly.

In the worst case scenario, this works as well as today's list package does.

Copy link
Member

@nkolev92 nkolev92 left a comment

Choose a reason for hiding this comment

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

I think we should just follow what build does and just trigger restore and let it do it's own checks.


When a user executes a NuGet command that requires restore, the system should:

1. **Check if restore has been performed and is up to date**
Copy link
Member

Choose a reason for hiding this comment

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

Just call restore, it'll perform it's own up to date check.
That's how build is implemented. It just calls restore, restore determines if anything needs to happen.

3. **Handle scenarios where restore is unsuccessful**
- If implicit restore fails due to network issues, package source unavailability, or conflicting dependencies, the command should fail with a clear error message.
- If `--no-restore` is specified and the assets file is missing or outdated, the command should either:
- Proceed with a warning that the results may be inaccurate.
Copy link
Member

Choose a reason for hiding this comment

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

tbh, I wouldn't mess with the outdated check.
The rest of the implicit commands also don't mess with it.
If you skip the implicit command, we should just assume it's correct until we have a good reason to make it more costly.

In the worst case scenario, this works as well as today's list package does.


<!-- Explain the proposal in sufficient detail with implementation details, interaction models, and clarification of corner cases. -->

The command should invoke restore **only when necessary**, checking the assets file has against the project dgspec has.
Copy link
Member

Choose a reason for hiding this comment

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

Determining whether restore is necessary is basically no-op. The first step of the restore command is no-op, so while there's some extra overhead of calling the msbuild process, I think in terms of correctness we're better off not duplicating the restore no-op logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dotnet list package doesn't restore
3 participants