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

Visual studio locks up when I create project from Existing Node.js Source #427

Closed
SteveALee opened this issue Sep 6, 2015 · 43 comments · Fixed by #553
Closed

Visual studio locks up when I create project from Existing Node.js Source #427

SteveALee opened this issue Sep 6, 2015 · 43 comments · Fixed by #553

Comments

@SteveALee
Copy link

After creating a new project the VS UI locks up completely and I need to end task VS. I then open the project and all is well.

Is there any way I can find out what's happening?

I have tried:

  • Stripping project down to empty index.js and simple package.json created with "npm init"
  • removing all spaces from the path - C:\Users\Steve\Documents\projects\spikes\hapi-book
  • disabling "add to version" control in the create wizard - which seems to do nothing anyway
  • disabling / removing various VS extensions

I have VS community 2015 and updated everything to latest

Any ideas?

@zhengbli
Copy link

zhengbli commented Sep 8, 2015

Does this happen with the RC2 version of node tool? Also, does this happen when you add the new project to a existing solution or creating a new solution?

@mousetraps
Copy link
Contributor

Do you happen to have a bower_components or node_modules folder that is not at the root of your project?

See #430 (which I just filed)

@SteveALee
Copy link
Author

@zhengbli I didn't see RC2 so just downloaded 1.1 (I did reinstall it just in case). I deleted the sln and proj and created new project

@mousetraps No. I stripped down to just an empty index.js and simple package.json with no more files and folders.

@SteveALee
Copy link
Author

@zhengbli where can I find RC2?

@zhengbli
Copy link

zhengbli commented Sep 8, 2015

@SteveALee You can find the download link at http://aka.ms/ntvslatest

@zhengbli
Copy link

zhengbli commented Sep 8, 2015

Also can you do the following to help us diagnose the problem:

  1. open task manager, go to "details" tab
  2. right click on one of the column names, choose "select columns"
  3. check "command line" in the list
  4. repro the problem, and take a screenshot of the task manager details tab with the "command line" column, so we can figure out what is taking up the resources.

Thanks!

@SteveALee
Copy link
Author

The UI is locked but nothing much is happening with devenv.exe - it appears to be 0 cycles. It doesnt't appear to ever recover. This is the screen shot of VS straight after creating the project

ntvs427vs

@SteveALee
Copy link
Author

Here is my package.json

{
  "name": "dindin",
  "version": "0.0.0",
  "description": "wibble",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

Index.js is empty (but same problem if it has content)

.njsproj

    
        Debug
        2.0
        {1bf69820-c08a-4207-8084-5f6b180e52ff}
        
        ShowAllFiles
        index.js
        .
        .
        {3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}
        11.0
        $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
    
    
    
    
        
        
    
    
    
    
    
    
    
        
          
            
              False
              True
              0
              /
              http://localhost:48022/
              False
              True
              http://localhost:1337
              False
            
          
          
            
              
              
              CurrentPage
              True
              False
              False
              False
              
              
              
              
              
              
              
              
              False
              False
            
          
        
    

The path

C:\Users\Steve\Documents\projects\spikes\hapi-book-Copy.vs\NodejsApp1\v14
is empty

@zhengbli
Copy link

zhengbli commented Sep 9, 2015

@SteveALee I tested using your files and couldn't repro the problem. And as the content of the .njsproj is parsed by GitHub somehow I cannot see all of it. Could you put it as a gist and share the link? Thanks!

@SteveALee
Copy link
Author

@zhengbli oh what a mess. I thought markdown escaped that critical tags. Will sort out.

@SteveALee
Copy link
Author

@zhengbli
Copy link

zhengbli commented Sep 9, 2015

Ok the njproj file is identical to what I have on my machine, except the projectGuid. That means it can create the project fine, only has problems when trying to open it. A recent fix at #396 might be related to that part. Although @mousetraps @billti do you have any idea why no .suo files are generated?

@billti
Copy link
Member

billti commented Sep 9, 2015

The .suo files are an artifact of Visual Studio, and not specific to NTVS. Are they being created for other project/solution types? If not, then it would seem to be a general VS error.

Is there anything unique/interesting about this configuration? Are you creating projects on a local drive? Do you have My Document redirected? Any other extensions installed into VS? etc.

@SteveALee
Copy link
Author

@billti Perhaps the lack of .suo files are due to having no code in the index.js?

Nothing unusually interesting. here :)
I disabled all the new extensions. Also moved test project folder to c:.

In desperation I have uninstalled VS (13 and 15), removed all the Azure and SQL server items left and reinstalled VS community using typical rather than full. Also re installed NTVS 1.1 RC2. I probably uninstalled too much as VS install errored about SQL Server compact 4 missing path (haven't resolved that one yet) and VS errors on startup about the resource manager package not loading properly.

The bad news is VS STILL locks up after adding the new project. It's just that now the VS UI is in a incomplete state and not showing the main window

I wonder is it possibly as I am not using TFS?

Anyway I can at least work around it by restarting VS and as you can't see it perhaps mark as cannot reproduce?

Now I need to sort out my VS installation.

@zhengbli
Copy link

@SteveALee Hi Steve, we just updated the RC2 with a couple of fixes that may be related to your situation. If you have time could you give it a shot? https://github.com/Microsoft/nodejstools/releases/tag/v1.1-RC.2.1

@SteveALee
Copy link
Author

@zhengbli any chance of a binary?

@SteveALee
Copy link
Author

Scratch that, I read the notes. :)

@SteveALee
Copy link
Author

Yes! That fixes it!

Not sure from release notes why was problem that you could not reproduce but I'm happy now. Just need to restore VS to fully working.

Thanks.

@SteveALee SteveALee reopened this Sep 21, 2015
@SteveALee
Copy link
Author

I just tried to add create new from some existing code and it froze again, requiring a task kill and restart

This is the code
https://github.com/GPII/windows
or rather my fork, but that is unchanged

have 1.1 RC2.1

@SteveALee
Copy link
Author

Spotted the new release "9-17-2015 Dev Build" so tried it but still hangs on create new project

@SteveALee
Copy link
Author

I notice this after installing nvm-windows with node 4.1.0 and rolling back to 0.12.x. Nvm-windows messes with the path for npm (but don't know if that affects VS/NTVS) and also makes the %ProgramFiles%\nodejs folder a NTFS symbolic link.

Will rollback at some point and retest.

@mousetraps
Copy link
Contributor

Also are any node processes showing up in task manager when this issue occurs? If so, what are the corresponding contents of the "command line arguments" column in the details pane? If you kill those processes, does the project load successfully?

@SteveALee
Copy link
Author

OK - complete steps

  1. Create new blank console app NodejsConsoleApp1 in C:\Users\Steve\Documents\projects\
  2. rm NodejsConsoleApp1.sln .vs\ NodejsConsoleApp1\NodejsConsoleApp1.njsproj
  3. new project from source NodejsApp1 C:\Users\Steve\Documents\projects\NodejsConsoleApp1\NodejsConsoleApp1\ Create new solution

UI responds for a second or 2 as I mouse over Team Explorer but then freezes.

There are a bunch of node process but they are from web analyser which I installed after the problem reoccurred. When I previously looked during this state there were no node task

nodeprocs

@SteveALee
Copy link
Author

SO I killed all those node process (appears to be a bug win web analyser) and disabled web analyser extension but have exactly the same symptoms.

@mousetraps
Copy link
Contributor

Thanks, looks like we'll need some more info then... would you mind sending us a dump of devenv.exe when the issue occurs? The quickest way to create a dump is by right clicking the process in Task Manager, and selecting "create dump file". Process explorer, procdump, etc. also work. You can then zip it up and upload it somewhere (post a link here, email it to me, or send it to ntvshelp at microsoft com)

Thanks for your patience so far - hopefully we can get to the bottom of it soon!

@SteveALee
Copy link
Author

Minidump is http://opendirective.net/NTVS/devenv.zip (~300MB).

Note that the NodejsApp1.njsproj was created by VS but no other project files where.

@mousetraps
Copy link
Contributor

Thanks! Now we're getting somewhere 😃

Stack trace of the main thread:

    [Managed to Native Transition]  
    WindowsBase.dll!System.Windows.Threading.DispatcherSynchronizationContext.Wait(System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)  Unknown
    mscorlib.dll!System.Threading.SynchronizationContext.InvokeWaitMethodHelper(System.Threading.SynchronizationContext syncContext, System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)    Unknown
    [Native to Managed Transition]  
    [Managed to Native Transition]  
    mscorlib.dll!System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle waitableSafeHandle, long millisecondsTimeout, bool hasThreadAffinity, bool exitContext)  Unknown
    mscorlib.dll!System.Threading.WaitHandle.WaitOne(System.TimeSpan timeout, bool exitContext) Unknown
    mscorlib.dll!System.Threading.WaitHandle.WaitOne(System.TimeSpan timeout)   Unknown
>   Microsoft.ApplicationInsights.dll!Microsoft.ApplicationInsights.Channel.InMemoryTransmitter.Runner() Line 94    C#
    mscorlib.dll!System.Threading.Tasks.Task.InnerInvoke()  Unknown
    mscorlib.dll!System.Threading.Tasks.Task.Execute()  Unknown
    mscorlib.dll!System.Threading.Tasks.Task.ExecutionContextCallback(object obj)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
    mscorlib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot)    Unknown
    mscorlib.dll!System.Threading.Tasks.Task.ExecuteEntry(bool bPreventDoubleExecution) Unknown
    mscorlib.dll!System.Threading.Tasks.SynchronizationContextTaskScheduler.PostCallback(object obj)    Unknown
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)  Unknown
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unknown
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl()   Unknown
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(object state)  Unknown
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke()   Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue()  Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)  Unknown
    WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Unknown
    WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Unknown
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)  Unknown
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs)   Unknown
    WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam)  Unknown
    [Native to Managed Transition]  

It looks like the main thread is blocked at a WaitOne call in ApplicationInsights (which we use for some of the new telemetry work in RC2.)

@sanyamc-msft any ideas?

@SteveALee
Copy link
Author

Great!
Wild thought - I'm not logged into TFS? Though I guess app insights is a runtime thing?

@SteveALee
Copy link
Author

I don't know if this is relevant as collateral damage but when I open my existing project after killing VS a number of files show as VC pending edit in the solutions explorer. However there are no diffs shown and git status shows no pending commits (as expected)

Any ideas how I might investigate this one?

@MoLow
Copy link

MoLow commented Oct 15, 2015

I experience this issue as well,
in order to get it working, I had to delete the .suo file

@SteveALee
Copy link
Author

@molo interesting as I didn't get a .suo file generated. Only the .nsjproj.

@ghost
Copy link

ghost commented Oct 16, 2015

I have this problem as well. Here is the exact code that I was trying to create a project for - https://github.com/ThoughtWorksStudios/node-aws-lambda

@mousetraps
Copy link
Contributor

Hmm... reading through the thread again, it sounds like this is also broken for you in NTVS 1.1 RC? If so, then it can't be due to the recent telemetry changes, so something else is amiss...

@mousetraps
Copy link
Contributor

@SteveALee @waynebloss I think I managed to fix this. Mind trying out this private build to verify?
https://github.com/mousetraps/nodejstools/releases/tag/import-fix

@ghost
Copy link

ghost commented Oct 17, 2015

@mousetraps Wow, thanks! I just tried it and it fixed the issue on my machine.

Should I just continue running this build for now or would you recommend installing the 10-14-2015 Dev Build release for any reason?

@SteveALee
Copy link
Author

@mousetraps 👍 \0/ it fixes it for me.

@waynebloss Looks like it's already in that pre-release :)

@mousetraps
Copy link
Contributor

Actually this is the diff (I didn't tag it correctly when creating the release)
v1.1.Dev-10.14.2015...mousetraps:import

@SteveALee
Copy link
Author

Oh, so you uploaded a binary for the release that did match the tag? They should detect that :)

So that diff makes a little more sense to me given the problem :)

mousetraps added a commit to mousetraps/nodejstools that referenced this issue Oct 19, 2015
…ing Node.js

source
- VS was locking up during a call into AppInsights, which has a bug in that
  it is possible to run on the UI Thread. Use HideScheduler to work around
  this issue.
mousetraps added a commit to mousetraps/nodejstools that referenced this issue Oct 19, 2015
…ing Node.js

source
- VS was locking up during a call into AppInsights, which has a bug in that
  it is possible to run on the UI Thread. Use HideScheduler to work around
  this issue.
mousetraps added a commit that referenced this issue Oct 20, 2015
#427 Visual Studio locks up when I create project from Existing Node.js
@mousetraps
Copy link
Contributor

The fix is now available in our latest dev build

@SteveALee
Copy link
Author

Excellent- thanks very much!

Steve Lee
OpenDirective http://opendirective.com

On 20 October 2015 at 15:42, Sara Itani notifications@github.com wrote:

The fix is now available in our latest dev build
https://github.com/Microsoft/nodejstools/releases


Reply to this email directly or view it on GitHub
#427 (comment)
.

@drewdunlop
Copy link

I'm running into this same issue. Repro is slightly different. When loading an existing project I encounter the same hang in the VS main thread due to App Insights.

I was using the 1.1 Release. Rolling back to 1.0 resolves the hang.

Let me know if more information would be of use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment