-
Notifications
You must be signed in to change notification settings - Fork 390
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
Changing active configuration should not trigger restore cycle detection #9567
Merged
drewnoakes
merged 5 commits into
dotnet:main
from
drewnoakes:fix-1951646-changing-configuration-does-not-cause-restore-cycle
Nov 14, 2024
Merged
Changing active configuration should not trigger restore cycle detection #9567
drewnoakes
merged 5 commits into
dotnet:main
from
drewnoakes:fix-1951646-changing-configuration-does-not-cause-restore-cycle
Nov 14, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drewnoakes
added
the
Feature-NuGet
NuGet integration including pushing it properties, project and package references, and Pack support.
label
Oct 25, 2024
Build failure fixed in #9568. Will rebase when that merges. |
Prevent potential collection corruption
We have a feature that attempts to detect patterns in NuGet restore data, flagging these as a runaway restore cycle, stopping the cyclic behaviour, and alerting the user. Test teams found a scenario where continuously changing active configuration (i.e. toggling between Debug and Release several times) would trigger the cycle detection logic incorrectly. This only happens when restore data differs between configurations. A new console app with some simple packages added does not trigger this. The .NET Project System repo would, however. This commit fixes the issue by including the active project configuration in the dataflow data, such that the cycle detector resets its state whenever the active configuration changes.
drewnoakes
force-pushed
the
fix-1951646-changing-configuration-does-not-cause-restore-cycle
branch
from
October 25, 2024 04:51
4ce15fa
to
9773e52
Compare
drewnoakes
commented
Oct 28, 2024
Comment on lines
+55
to
+64
_priorActiveProjectConfiguration ??= activeProjectConfiguration; | ||
|
||
if (!Equals(_priorActiveProjectConfiguration, activeProjectConfiguration)) | ||
{ | ||
// The active configuration changed. Treat this as a reset. This prevents flagging a | ||
// cycle when the user switches configurations repeatedly in certain repositories. | ||
_priorActiveProjectConfiguration = activeProjectConfiguration; | ||
Reset(); | ||
return false; | ||
} |
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.
This is the core fix. If the active configuration changes, clear all state in our detection logic. Most of the other changes in this PR exist to support this code.
melytc
approved these changes
Nov 14, 2024
drewnoakes
deleted the
fix-1951646-changing-configuration-does-not-cause-restore-cycle
branch
November 14, 2024 22:01
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Feature-NuGet
NuGet integration including pushing it properties, project and package references, and Pack support.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1951646
We have a feature that attempts to detect patterns in NuGet restore data, flagging these as a runaway restore cycle, stopping the cyclic behaviour, and alerting the user.
Test teams found a scenario where continuously changing active configuration (i.e. toggling between Debug and Release several times) would trigger the cycle detection logic incorrectly. This was causing failures in automated test runs.
This only happens when restore data differs between configurations. A new console app with some simple packages added does not trigger this. The .NET Project System repo would, however.
This commit fixes the issue by including the active project configuration in the dataflow data, such that the cycle detector resets its state whenever the active configuration changes.
Microsoft Reviewers: Open in CodeFlow