madskristensen / NpmTaskRunner

Visual Studio extension
Other
88 stars 32 forks source link

Visual Studio crashes when loading projects with large amount of npm scripts #21

Closed tijaune closed 8 years ago

tijaune commented 8 years ago

Installed product versions

When opening an ASP.NET core 1.0 R1 project containing a package.json file with 20 or more scripts, Visual Studio hangs. Removing any one script from the package.json or disabling the extension let the project to load as expected.

Steps to recreate

  1. Create a new C# Web project.
  2. Use the Empty ASP.NET core 1.0 RC1 template (do not host in the cloud).
  3. Wait for all the dependencies to restore.
  4. Close Visual Studio.
  5. Copy the included sample in a package.json file at the root of the project.
  6. Open Visual Studio.
  7. (optional) If the Task Runner Explorer did not pick up the file, click the refresh button.

Sample package.json causing the crash:

{
  "scripts": {
    "script01": "cmd",
    "script02": "cmd",
    "script03": "cmd",
    "script04": "cmd",
    "script05": "cmd",
    "script06": "cmd",
    "script07": "cmd",
    "script08": "cmd",
    "script09": "cmd",
    "script10": "cmd",
    "script11": "cmd",
    "script12": "cmd",
    "script13": "cmd",
    "script14": "cmd",
    "script15": "cmd",
    "script16": "cmd",
    "script17": "cmd",
    "script18": "cmd",
    "script19": "cmd",
    "script20": "cmd"
  }
}

Current behavior

Visual Studio will hang.

Expected behavior

The Task Runner Explorer should have no issue dealing with large amount of scripts.

Workaround

Keep the number of scripts in your package.json file under 20. Most of the time, you can easily move multi-part scripts into their own js files.

madskristensen commented 8 years ago

Can you please try with the latest CI build found here http://vsixgallery.com/extension/d7f89ba3-815c-4feb-89b9-68d1654e2138/

If it's not fixed, can you please share the package.json file?

madskristensen commented 8 years ago

Ok, I can reproduce it and a fix is coming shortly

tijaune commented 8 years ago

thank you for your flash response! I re-enabled with v1.2.54 and my project loaded successfully.

madskristensen commented 8 years ago

That's awesome. Thanks for the detailed bug report