aspnet / Tooling

Issue tracker and info on Visual Studio tooling for ASP.NET
Other
256 stars 124 forks source link

Task Runner Explorer - Detect hanging discovery of tasks #848

Open mjbvz opened 7 years ago

mjbvz commented 7 years ago

From @ste2425 on November 8, 2016 10:32

In my naivety i didn't fully understand how Gulp's watches worked. This led me to defining a watch outside of of a task. This meant as soon as the file was loaded and the watch fired up it prevented the process exiting.

In normal CLI use this wasn't noticeable, however when the Task Runner Explorer executes gulp --tasks-simple to find the tasks this excutes the watch causing that command to hang, which in turn causes the Task Runner Explorer to hang endlessly.

It was only after much trial and error i found the Gulp command the Task Runner Explorer executes which allowed me to debug the issue. If the Explorer detected the hanging script this would have been a trivial thing to understand and fix.

Expected Behavior

The user should be presented with some form of loading spinner to indicate the Task Runner Explorer is actively searching for tasks. Should discovery of tasks hang, it should be detected in some form and provide the user with an error.

Actual Behavior

The Task Runner Explorer does not present the user with any messages when searching for tasks. It still displays that there are no tasks available and does not display the NPM scripts either. The user is left non the wiser that the task runner explorer is actually currently searching for tasks, or that the command to Gulp to find the tasks is hanging.

The biggest issue here is that no errors are logged either as the Explorer has hung.

Steps to Reproduce
  1. Create gulpfile.js
  2. Add following code:
    
    'use strict';

var gulp = require('gulp');

gulp.watch('/*/.js', ['one']);

gulp.task('one', () => console.log('one'));


3. Open Task Runner Explorer: View -> Other Windows -> Task Runner Explorer
    It will sit there telling the user `No task runner configurations were found`. When in reality its currently hung searching for them.

4. NOTE: If you already had a working gulp file before making this change, upon saving it Task Runner Explorer won't update. When you re-load Visua Studio that's when it will not display anything.

I think its worth pointing out i understand this is not an issue with the NodeJS Tooling for VS directly. However i do believe that the interaction with third party tooling could have these hanging script fail safes in place the provide a greater user experience in the event of errors.

_Copied from original issue: Microsoft/nodejstools#1414_
mlorbetske commented 7 years ago

/cc @jodavis