Repository navigation
Conversation
|
I'm not 100% sure if NU1004 is the correct code I should use here. |
nkolev92
left a comment
There was a problem hiding this comment.
We could use a test here.
Also given that we're introducing a new customer facing message or potentially a new log code, we'll probably need an issue for that.
| { | ||
| success = false; | ||
|
|
||
| // invalid input since LockedMode and RestoreForce should not be used together. |
There was a problem hiding this comment.
RestoreForce and RestoreForceEvaluate are actually different.
|
|
||
| // directly log to the request logger when we're not going to rewrite the assets file otherwise this log will | ||
| // be skipped for netcore projects. | ||
| await _request.Log.LogAsync(RestoreLogMessage.CreateError(NuGetLogCode.NU1004, message)); |
There was a problem hiding this comment.
If you look at the log code, it refers to dependency changes, but this is more of an input thing, but this is closer to https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1005.
I think we either reuse NU1005 or add a new one.
What do you think?
There was a problem hiding this comment.
Hmm I think we can reuse NU1005 because is related to RestorePackagesWithLockFile but the error is more related to the use of commands so we can go either way.
There was a problem hiding this comment.
It's conflicting/bad input.
NU1005 was gonna be my suggestion as well.
We can document the 2 instances where that warning is raised.
|
@nkolev92 I'll add the tests for this, but looking at the code, is this error only going to happen when the lockfile exists? |
|
Either way is fine, as I don't expect customers who aren't using lock files would run this. Might be easier to just raise the error every time the input is weird like that. |
|
This PR has been automatically marked as stale because it has no activity for 7 days. It will be closed if no further activity occurs within another 7 days of this comment. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch. |
2 similar comments
|
This PR has been automatically marked as stale because it has no activity for 7 days. It will be closed if no further activity occurs within another 7 days of this comment. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch. |
|
This PR has been automatically marked as stale because it has no activity for 7 days. It will be closed if no further activity occurs within another 7 days of this comment. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch. |
|
Documentation update pr NuGet/docs.microsoft.com-nuget#2685 |
|
question: Say I have If so, what is the expected workflow for a customer who has the Directory.Build.props setting, and they edit a csproj and need to update the lock files? |
e8fcebc to
98de990
Compare
|
@zivkan Not sure, I havent worked with |
|
@martinrrm think of it from a customer's point of view. They edit their csproj to add a new PackageReference, or change a package version. They run restore, and get an error saying that the project is inconsistent with the lock file, and to run force evaluate. They then run force evaluate, but get an error saying that you can't run force evaluate and locked mode at the same time. Is the "average developer" going to understand/find a way to become successful? I'm not sure if the messages output to console, or the docs (that you recently updated in NuGet/docs.microsoft.com-nuget#2685), give enough information to customers on how to resolve the issue. While the docs does say "Rerun restore without locked mode to regenerate the lock file.", if the customer didn't provide MSBuild's complexity makes it impossible for us to generate a great error message. Whether or not it should block this PR, I sugggest you play around a little to lean more about MSBuild, and then talk to the PMs and get an agreement with them about what the customer experience should be. |
|
This PR has been automatically marked as stale because it has no activity for 7 days. It will be closed if no further activity occurs within another 7 days of this comment. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch. |
98de990 to
fa7df2d
Compare
|
This PR has been automatically marked as stale because it has no activity for 7 days. It will be closed if no further activity occurs within another 7 days of this comment. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch. |
fa7df2d to
15f3ed9
Compare
c3b2d4b to
f4cc362
Compare
|
Team Review: We think ForeReevaluate should just override restore locked mode or the error message should tell the user to specify |
|
PM Office Hours: |
|
This PR has been automatically marked as stale because it has no activity for 7 days. It will be closed if no further activity occurs within another 7 days of this comment. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch. |
|
This PR has been automatically marked as stale because it has no activity for 7 days. It will be closed if no further activity occurs within another 7 days of this comment. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch. |
When restore ran with both RestoreLockedMode=true and RestoreForceEvaluate=true, the contradictory inputs were silently reconciled in favor of force-evaluate: the lock file was re-evaluated and regenerated, locked-mode enforcement never ran, and nothing told the user their locked-mode guarantee was being ignored. Per the PM/team decision recorded on the earlier attempt (#4434), force-evaluate should continue to take precedence so that the legitimate "edit a csproj, then force-evaluate to refresh the lock file" workflow keeps working (locked mode is often set in a Directory.Build.props). Instead of failing the restore, emit a warning so the override is no longer silent. The warning reuses NU1005 and is gated behind SdkAnalysisLevel >= 11.0.100, since the feature guide treats a new restore warning as an in-scope change that must be gated to avoid breaking -warnaserror builds on older SDKs. It is additionally guarded to fire only when a lock file is in play and on the original restore action, matching the surrounding locked-mode code paths. Fixes: NuGet/Home#8222 Co-authored-by: Copilot <[email protected]>
When restore ran with both RestoreLockedMode=true and RestoreForceEvaluate=true, the contradictory inputs were silently reconciled in favor of force-evaluate: the lock file was re-evaluated and regenerated, locked-mode enforcement never ran, and nothing told the user their locked-mode guarantee was being ignored. Per the PM/team decision recorded on the earlier attempt (#4434), force-evaluate should continue to take precedence so that the legitimate "edit a csproj, then force-evaluate to refresh the lock file" workflow keeps working (locked mode is often set in a Directory.Build.props). Instead of failing the restore, emit a warning so the override is no longer silent. The warning reuses NU1005 and is gated behind SdkAnalysisLevel >= 11.0.100, since the feature guide treats a new restore warning as an in-scope change that must be gated to avoid breaking -warnaserror builds on older SDKs. It is additionally guarded to fire only when a lock file is in play and on the original restore action, matching the surrounding locked-mode code paths. Fixes: NuGet/Home#8222 Co-authored-by: Copilot <[email protected]>
When restore ran with both RestoreLockedMode=true and RestoreForceEvaluate=true, the contradictory inputs were silently reconciled in favor of force-evaluate: the lock file was re-evaluated and regenerated, locked-mode enforcement never ran, and nothing told the user their locked-mode guarantee was being ignored. Per the PM/team decision recorded on the earlier attempt (#4434), force-evaluate should continue to take precedence so that the legitimate "edit a csproj, then force-evaluate to refresh the lock file" workflow keeps working (locked mode is often set in a Directory.Build.props). Instead of failing the restore, emit a warning so the override is no longer silent. The warning uses a dedicated new code, NU1512, and is gated behind SdkAnalysisLevel >= 11.0.100, since the feature guide treats a new restore warning as an in-scope change that must be gated to avoid breaking -warnaserror builds on older SDKs. It is additionally guarded to fire only when a lock file is in play and on the original restore action, matching the surrounding locked-mode code paths. A dedicated code (rather than reusing the existing NU1005 error) lets this warning carry its own documentation. Fixes: NuGet/Home#8222 Co-authored-by: Copilot <[email protected]>
#7451) * Warn when RestoreForceEvaluate overrides RestoreLockedMode When restore ran with both RestoreLockedMode=true and RestoreForceEvaluate=true, the contradictory inputs were silently reconciled in favor of force-evaluate: the lock file was re-evaluated and regenerated, locked-mode enforcement never ran, and nothing told the user their locked-mode guarantee was being ignored. Per the PM/team decision recorded on the earlier attempt (#4434), force-evaluate should continue to take precedence so that the legitimate "edit a csproj, then force-evaluate to refresh the lock file" workflow keeps working (locked mode is often set in a Directory.Build.props). Instead of failing the restore, emit a warning so the override is no longer silent. The warning reuses NU1005 and is gated behind SdkAnalysisLevel >= 11.0.100, since the feature guide treats a new restore warning as an in-scope change that must be gated to avoid breaking -warnaserror builds on older SDKs. It is additionally guarded to fire only when a lock file is in play and on the original restore action, matching the surrounding locked-mode code paths. Fixes: NuGet/Home#8222 Co-authored-by: Copilot <[email protected]> * Use a dedicated NU1512 warning code instead of reusing NU1005 Per PR review feedback, give the "RestoreForceEvaluate overrides RestoreLockedMode" warning its own code rather than overloading the existing NU1005 error (which has the distinct meaning "Invalid combination of RestorePackagesWithLockFile and packages.lock.json file"). NU1512 sits in the restore input-warning range (1500-1599) and lets this warning carry its own documentation page. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
Bug
Fixes: NuGet/Home#8222
Regression? Last working version:
Description
Using
RestoreLockedModeandRestoreForceEvaluateat the same time is contradictory.PR Checklist
PR has a meaningful title
PR has a linked issue.
Described changes
Tests
Documentation