microsoft / nodejstools

Node.js Tools for Visual Studio
http://aka.ms/explorentvs
Apache License 2.0
1.8k stars 358 forks source link

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

Closed SteveALee closed 9 years ago

SteveALee commented 9 years ago

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:

I have VS community 2015 and updated everything to latest

Any ideas?

zhengbli commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

@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 commented 9 years ago

@zhengbli where can I find RC2?

zhengbli commented 9 years ago

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

zhengbli commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

@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 commented 9 years ago

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

SteveALee commented 9 years ago

@zhengbli Please see https://gist.github.com/SteveALee/a9f838b79639949ac879

zhengbli commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

@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 commented 9 years ago

@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 commented 9 years ago

@zhengbli any chance of a binary?

SteveALee commented 9 years ago

Scratch that, I read the notes. :)

SteveALee commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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

SteveALee commented 9 years ago

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.

SteveALee commented 9 years ago

I just tried again using latest nodejstools release, nvm-windows and node 0.10.40 and it still freezes :(

mousetraps commented 9 years ago

Hmm... Still can't repro... Can you try a simple experiment? temporarily rename your global node_modules folder (the one listed when you execute "npm bin -g"). Then add from existing with mostly empty folder (no npm modules installed).

mousetraps commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

Thanks! Now we're getting somewhere :smiley:

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 commented 9 years ago

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

SteveALee commented 9 years ago

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 commented 9 years ago

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

SteveALee commented 9 years ago

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

ghost commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

@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 commented 9 years ago

@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 commented 9 years ago

@mousetraps :+1: \0/ it fixes it for me.

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

mousetraps commented 9 years ago

Actually this is the diff (I didn't tag it correctly when creating the release) https://github.com/Microsoft/nodejstools/compare/v1.1.Dev-10.14.2015...mousetraps:import

SteveALee commented 9 years ago

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 commented 9 years ago

The fix is now available in our latest dev build

SteveALee commented 9 years ago

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 https://github.com/Microsoft/nodejstools/issues/427#issuecomment-149588673 .

drewdunlop commented 8 years ago

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.