-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix Visual Studio deadlock caused by restore target calls in BeforeResolveReferences #15137
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
Conversation
- Remove MSBuild calls to Restore target from BeforeResolveReferences in VS builds - Add explanatory comments documenting why restore calls cause deadlocks - Preserve all other functionality while fixing the deadlock issue - Visual Studio will handle NuGet restoration through its own mechanisms Co-authored-by: anupriya13 <[email protected]>
restore target in VS leads to a deadlock|
The "problematic" target served a purpose: allowing developers to fully build (and fetch C++ dependencies) from within Visual Studio. If there is no way around dropping this target, documentation should also be updated including a workaround to restore dependencies outside the IDE. |
| 2. It violates the restore/build contract (restore must complete before build starts) | ||
| 3. Network calls during restore on UI thread cause performance issues and potential deadlocks | ||
| Visual Studio will handle NuGet package restoration automatically through its own mechanisms. |
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.
Can you please confirm this actually happens and the target's removal is fully transparent to the user?
|
@JunielKatarn , lately I see the deadlock in my Visual Studio too often. It is a huge waste of time. |
What you suggest should be doable. Regarding the deadlock, this PR should address that (making my suggestion above mandatory), but I don't own this work item and don't know its status. |
This PR fixes a critical deadlock issue in Visual Studio when building React Native Windows C++ projects. The problem occurred when MSBuild targets called the
Restoretarget during theBeforeResolveReferencesphase of Visual Studio builds.Problem
The
BeforeResolveReferencestarget in bothMicrosoft.ReactNative.Common.targetsandvnext/Directory.Build.targetswas calling the NuGetRestoretarget whenBuildingInsideVisualStudiowas true. This caused several issues:Solution
Removed the problematic
BeforeResolveReferencestargets that were callingMSBuildtasks withTargets="Restore". Visual Studio has its own built-in NuGet package restoration mechanisms that handle this properly without the deadlock risk.The fix includes:
BeforeResolveReferencestargets from both affected filesFiles Changed
vnext/PropertySheets/External/Microsoft.ReactNative.Common.targetsvnext/Directory.Build.targetsBoth files had identical problematic patterns that have been resolved.
Fixes #15108.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.
Microsoft Reviewers: Open in CodeFlow