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

Restore operations happen in foreground in Class Library projects in Visual Studio #710

Closed
OronDF343 opened this issue Jun 8, 2023 · 0 comments · Fixed by #717
Closed

Comments

@OronDF343
Copy link

Describe the bug

In Class Library projects in Visual Studio, package restores are performed in the foreground, which causes Visual Studio to become unresponsive.

For example, changing the destination will cause Visual Studio to become unresponsive while files are deleted from their old location one by one. In addition, the file deletions are performed via the system shell, which may pop up the progress dialog from File Explorer, and that also causes mouse/keyboard focus to be lost temporarily, so I cannot continue work in another window during this operation.

To Reproduce

Steps to reproduce the behavior:

  1. Create a new Class Library project (SDK-style) in Visual Studio. Not sure if the target framework matters, mine has multi-targeting: net6.0;netstandard2.1;net472
  2. Add a new file named libman.json with the following content and save it:
{
  "version": "1.0",
  "defaultProvider": "cdnjs",
  "libraries": [
    {
      "library": "tom-select@2.2.2",
      "destination": "lib/tom-select"
    }
  ]
}
  1. Change the destination to lib/tom-select2 and save the file again. Visual Studio will now become unresponsive.

Expected behavior

The restore operation should happen in the background, just like projects targeting Microsoft.NET.Sdk.Web.

Screenshots

This demonstrates what I mean by "deleting one by one using the system shell":
image

Additional context

  • Visual Studio version 17.6.0
  • Microsoft Library Manager version 2.1.178.29796
  • Windows 10 version 22H2
jimmylewis added a commit to jimmylewis/LibraryManager that referenced this issue Sep 19, 2023
We can share behavior across all CPS projects for handling files additions/removals.  CPS is much more efficient for bulk edits - they work from the file system automatically, so we don't have to do batched edits on the UI thread in VS. This is something we should take advantage of for as many project types as possible, not limited to DotNetCoreWeb.

Addresses aspnet#710
jimmylewis added a commit to jimmylewis/LibraryManager that referenced this issue Sep 19, 2023
We can share behavior across all CPS projects for handling files additions/removals.  CPS is much more efficient for bulk edits - they work from the file system automatically, so we don't have to do batched edits on the UI thread in VS. This is something we should take advantage of for as many project types as possible, not limited to DotNetCoreWeb.

Addresses aspnet#710
jimmylewis added a commit that referenced this issue Sep 24, 2023
We can share behavior across all CPS projects for handling files additions/removals.  CPS is much more efficient for bulk edits - they work from the file system automatically, so we don't have to do batched edits on the UI thread in VS. This is something we should take advantage of for as many project types as possible, not limited to DotNetCoreWeb.

Addresses #710
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 a pull request may close this issue.

1 participant