-
Notifications
You must be signed in to change notification settings - Fork 258
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
VS19 Package Restore repeats 14 times #9686
Comments
For SDK style projects, as you make changes to files that may impact the package graph, restores are triggered automatically. A couple of other questions related to this experience:
|
To clarify - I wasn't working with Visual Studio - I was just waiting for it to "settle down". All but the first restore was unnecessary. They don't explicitly prevent anything - the problem is that unnecessary package restores cause incremental builds to take much longer. Every project fails Visual Studio's Fast Up To Date check since various files in their obj directory get "touched". When "Fast Up To Date" works, building X takes less than a second. When it fails, it's more like 30-40 seconds. So it's a useability/performance issue for me. |
Also, please see this comment: If package restore runs, and discovers that nothing needs updating, would it be possible for it to not change the timestamp on the various json files it creates? The file contents are not changing, only the timestamps. Which makes VS fail "Fast Up To Date". |
Whenever the project system detects something is not up to date and it affects NuGet, it nominates. NuGet does have checks to identify whether the assets file is up top date before writing. We try not to write unless absolutely necessary. Are you seeing the timestamp of the assets file get updated? Can you provide a repro yourself? Thanks. |
I will try to reproduce. I've observed that it is worse first thing in the morning (when I open the solution). You say "when the project system detects something is not up to date" - is it possible for me to enable diagnostics so that I can find out what is considered not up to date? What things would trigger nuget? Obviously any package or project reference changes in and *proj file. Also, if nuget updates project X, then it probably needs to update any project depending on X. However, I want to capture the cause of the "first" nuget trigger, as we don't update package/project references every day. |
Set the environment variable If the multiple NuGet restores correspond to multiple "BEGIN Nominate Restore" logs in the project output, then NuGet is correctly responding to the requests that project system is sending. |
Ok - I see lots of new "BEGIN Nominate" messages, despite the fact that the solution has previously been completely restored, and nothing has changed since. So if the requests are spurious, that's an issue in the project system? |
Yeah, that sounds like best handled on the project system side. |
If you can look at all the BEGIN Nominate messages and find all the nominations for one project, can you spot any differences? |
I have noticed something further. We use floating versions for one of our package references.
These messages occurred more than 40 times (I cleared the log part way through so don't know how many more). The "Begin Nominate Restore" messages seem ok, in that I don't see more than 1 per csproj. |
The floating references by themselves would normally not affect the up to date check, #5445.
That's a bit weird. In that case the potential answer could be that the project loading is spaced out, and if they take too much time in between it can trigger many restores. To help us better understand your exact scenario, it'd be great if you could start with a new instance of Visual Studio and file feedback using https://docs.microsoft.com/en-us/visualstudio/ide/how-to-report-a-problem-with-visual-studio?view=vs-2019#:~:text=In%20Visual%20Studio%2C%20select%20the,Send%20Feedback%20%3E%20Report%20a%20Problem.. That will contain some additional metrics that I can take a look at to better understand what's happening in your scenarios. It's important that the feedback is submitted from the same VS instance that's having the problem. |
Did you get a chance to file an issue through Visual Studio report a feedback? |
Hey all, I appreciate the time taking to file this issue. We still have lots of room for improvements, but given that we don't have a clear repro here, I'm going to close this issue. I'd be happy to look into any additional logs to help triage and reopen/open new issues as necessary. |
Our Visual Studio solution (146 projects) often repeatedly restores nuget packages. This, combined with an issue with the Fast Up To Date check, means that our builds are much slower than necessary.
Any ideas why this should happen? Are there additional diagnostics I can turn on (for the fast up to date check, I had to fiddle with the VS private registry hives)
Using Visual Studio Version 16.6.2.
I attached sanitized package manager log. Restore was repeated 14 times in total (got bored trimming the log at around half that)
RepeatedNugetRestore.txt
The text was updated successfully, but these errors were encountered: