1

Resolved

Creating New Project Hangs - Network Drives

description

Hi,

I have been experimenting with PTVS quite happily creating projects on my local drive.

Tonight I decided to start creating projects on my NAS using a network share, however I am running into issues. After selecting the location '\NASII\rdouble\documents\trading' in the New Project Dialog box, and clicking OK, Visual Studio then notifies me it is creating the project with a progress bar but never finishes. Eventually I have to kill the Visual Studio process.

I have tried creating other types of Visual Studio projecs i.e. Visual Basic etc., on the network share and this works fine, so presumably this something to do with PTVS? Any help or suggestions would be welcome.

Thanks

Robert

comments

Zooba wrote Aug 11 at 6:38 PM

What type of project were you creating?

Also, you may have more luck with PTVS 2.1 RC which we just released. Can you see if that still shows the issue?

rx2 wrote Aug 12 at 5:53 AM

I was creating a Python application. I have just upgraded to the latest RC release and the issue still exists. I have also tried creating an IronPython application and the same issue presents itself. As noted before, other VS application templates e.g. Visual Basic seem to work fine.

Since my last post I have discovered a little oddity. When creating the project VS becomes stuck with presenting a never-ending progress bar for creating the project, which I cannot break. However, at this point VS has actually created all the files, well at least the .SLN, .pyproj, and a .py. If I then go and try to delete the project directory it causes VS to come back indicating "Error reading <path to direct>".

Hope that helps...

rx2 wrote Aug 12 at 8:30 AM

A little more information that has come to light.

It seems VS only becomes stuck in a never ending progress bar when "Create directory for solution" is checked. If I uncheck this it works fine. For the time being I will use it unchecked.

Zooba wrote Aug 13 at 6:05 PM

This may be specific to your NAS, it certainly doesn't repro with just any file share. Since the files are created, we've presumably made it into our loading code, which means we can fix it once we figure out what's going on.

The workaround is probably a good hint for us, though I don't believe we do anything significantly different there. If you are able to attach to VS with another instance of VS and see where we are getting stuck while loading is frozen, that would be a great help. Our symbols are on the Microsoft Symbol Server, and that should get you line numbers for our code (or you can grab our source and see exactly where it is). Problems like this tend to be obvious once we know where to look.

rx2 wrote Aug 15 at 12:36 PM

Unfortunately I am unable to get the symbol tables loaded. I have them downloaded from the MS Symbol Server but for some reason VS can't locate. I even try to locate the Symbol file manually by selecting it e.g. "Microsoft.Python.Tools.Debugger.Helper.x64.pdb" but VS complains "A matching symbol file was not in this folder.

If pause the debugger while the progress bar is in a never-ending state then I can see a number of threads running.

Call stack for Main Thread:
[Managed to Native Transition]  
mscorlib.dll!Microsoft.Win32.SafeHandles.SafeFileHandle.ReleaseHandle() Unknown
[Native to Managed Transition]  
mscorlib.dll!System.Runtime.InteropServices.SafeHandle.Dispose(bool disposing)  Unknown
System.dll!System.IO.FileSystemWatcher.StopRaisingEvents()  Unknown
System.dll!System.IO.FileSystemWatcher.Restart()    Unknown
System.dll!System.IO.FileSystemWatcher.InternalBufferSize.set(int value)    Unknown
Microsoft.PythonTools.dll!Microsoft.VisualStudioTools.Project.CommonProjectNode.CreateFileSystemWatcher(string dir) Unknown
Microsoft.PythonTools.dll!Microsoft.VisualStudioTools.Project.CommonProjectNode.Reload()    Unknown
Microsoft.PythonTools.dll!Microsoft.PythonTools.Project.PythonProjectNode.Reload()  Unknown
Microsoft.PythonTools.dll!Microsoft.VisualStudioTools.Project.ProjectNode.Load(string fileName, string location, string name, uint flags, ref System.Guid iidProject, out int canceled) Unknown
Microsoft.PythonTools.dll!Microsoft.VisualStudioTools.Project.CommonProjectNode.Load(string filename, string location, string name, uint flags, ref System.Guid iidProject, out int canceled)   Unknown
Microsoft.PythonTools.dll!Microsoft.VisualStudioTools.Project.ProjectNode.InitializeForOuter(string filename, string location, string name, uint flags, ref System.Guid iid, out System.IntPtr projectPointer, out int canceled)    Unknown
[Native to Managed Transition]  
[Managed to Native Transition]  
Microsoft.PythonTools.dll!Microsoft.VisualStudioTools.Project.ProjectFactory.CreateProject(string fileName, string location, string name, uint flags, ref System.Guid projectGuid, out System.IntPtr project, out int canceled) Unknown
Microsoft.VisualStudio.Shell.12.0.dll!Microsoft.VisualStudio.Shell.Flavor.FlavoredProjectFactoryBase.Microsoft.VisualStudio.Shell.Interop.IVsProjectFactory.CreateProject(string fileName, string location, string name, uint flags, ref System.Guid projectGuid, out System.IntPtr project, out int canceled)  Unknown
[Native to Managed Transition]  
[Managed to Native Transition]  
Microsoft.VisualStudio.TemplateWizard.dll!Microsoft.VisualStudio.TemplateWizard.Wizard.Execute(object application, int hwndOwner, ref object[] ContextParams, ref object[] CustomParams, ref EnvDTE.wizardResult retval)    Unknown
[Native to Managed Transition]  
[Managed to Native Transition]  
Microsoft.VisualStudio.Dialogs.dll!Microsoft.VisualStudio.Dialogs.ServiceHelper.AddProjectFromSelectedTemplate(Microsoft.VisualStudio.Dialogs.INewProjectDialogData dialog, string projectPath, bool isExclusive)   Unknown
Microsoft.VisualStudio.Dialogs.dll!Microsoft.VisualStudio.Dialogs.SVsDialogService.CreateProject(Microsoft.VisualStudio.Dialogs.INewProjectDialogData npdd) Unknown
Microsoft.VisualStudio.Dialogs.dll!Microsoft.VisualStudio.Dialogs.SVsDialogService.InvokeDialog(Microsoft.Internal.VisualStudio.Shell.Interop.VSNEWPROJECTDLGINFO dlgInfo, out string bstrLocation) Unknown
[Native to Managed Transition]  
[Managed to Native Transition]  
Microsoft.VisualStudio.Shell.12.0.dll!Microsoft.Internal.VisualStudio.PlatformUI.DataSource.Invoke(string verb, object pvaIn, out object pvaOut)    Unknown
Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.PlatformUI.VsCommand.Execute(object parameter)  Unknown
PresentationFramework.dll!MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(System.Windows.Input.ICommandSource commandSource, bool userInitiated)   Unknown
PresentationFramework.dll!System.Windows.Controls.MenuItem.InvokeClickAfterRender(object arg)   Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)  Unknown
WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, 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!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, 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


Call Stack for Thread 5700 - No Name
mscorlib.dll!System.Threading.WaitHandle.WaitAny(System.Threading.WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext) Unknown
Microsoft.PythonTools.VSInterpreters.dll!Microsoft.PythonTools.RegistryWatcher.Worker(object param) Unknown
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(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
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart(object obj)  Unknown

Call Stack for Thread 3664 No Name
mscorlib.dll!System.Threading.WaitHandle.WaitAny(System.Threading.WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext)  Unknown
Microsoft.PythonTools.IronPython.Interpreter.dll!Microsoft.PythonTools.RegistryWatcher.Worker(object param) Unknown
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(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
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart(object obj)  Unknown

Btw my NAS is just a Windows 7 Pro machine with a file share.

Zooba wrote Aug 15 at 4:22 PM

That looks like enough information to go on, and the main thread is about where I expected it to be.

It's still very interesting that the problem doesn't exist without the solution folder. We don't care about that folder, but VS probably puts its own file system watcher on it - there may be some race condition between those two when the path is on a remote machine.

crwilcox wrote Sep 4 at 11:51 PM

This is probably the same stack trace as rx2 provided but I wanted to put it here just in case. Jing just saw this but we can't make it happen again. Getting a reliable repro is still challenging.
[Managed to Native Transition]  
mscorlib.dll!Microsoft.Win32.SafeHandles.SafeFileHandle.ReleaseHandle() Unknown
[Native to Managed Transition]  
mscorlib.dll!System.Runtime.InteropServices.SafeHandle.Dispose(bool disposing)  Unknown
System.dll!System.IO.FileSystemWatcher.StopRaisingEvents()  Unknown
System.dll!System.IO.FileSystemWatcher.Restart()    Unknown
System.dll!System.IO.FileSystemWatcher.InternalBufferSize.set(int value)    Unknown
Microsoft.PythonTools.dll!Microsoft.VisualStudioTools.Project.CommonProjectNode.CreateFileSystemWatcher(string dir) Unknown
Microsoft.PythonTools.dll!Microsoft.VisualStudioTools.Project.CommonProjectNode.Reload()    Unknown
Microsoft.PythonTools.dll!Microsoft.PythonTools.Project.PythonProjectNode.Reload()  Unknown
Microsoft.PythonTools.dll!Microsoft.VisualStudioTools.Project.ProjectNode.Load(string fileName, string location, string name, uint flags, ref System.Guid iidProject, out int canceled) Unknown
Microsoft.PythonTools.dll!Microsoft.VisualStudioTools.Project.CommonProjectNode.Load(string filename, string location, string name, uint flags, ref System.Guid iidProject, out int canceled)   Unknown
Microsoft.PythonTools.dll!Microsoft.VisualStudioTools.Project.ProjectNode.InitializeForOuter(string filename, string location, string name, uint flags, ref System.Guid iid, out System.IntPtr projectPointer, out int canceled)    Unknown
[Native to Managed Transition]  
[Managed to Native Transition]  
Microsoft.PythonTools.dll!Microsoft.VisualStudioTools.Project.ProjectFactory.CreateProject(string fileName, string location, string name, uint flags, ref System.Guid projectGuid, out System.IntPtr project, out int canceled) Unknown
Microsoft.VisualStudio.Shell.12.0.dll!Microsoft.VisualStudio.Shell.Flavor.FlavoredProjectFactoryBase.Microsoft.VisualStudio.Shell.Interop.IVsProjectFactory.CreateProject(string fileName, string location, string name, uint flags, ref System.Guid projectGuid, out System.IntPtr project, out int canceled)  Unknown
[Native to Managed Transition]  
[Managed to Native Transition]  
Microsoft.PythonTools.dll!Microsoft.PythonTools.Commands.ImportWizardCommand.CreateProjectAndHandleErrors() Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine)  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.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()    Unknown
mscorlib.dll!System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation..cctor.AnonymousMethod__6(object state) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)  Unknown
WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, 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!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, 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

Zooba wrote Sep 5 at 5:14 PM

Looks like we really need a process dump so we can inspect the native locks and stacks.

As far as I can tell we're deadlocking on calling CloseHandle on an open directory handle. The place in the main thread where this happens is hardly our fault (more specifically, we can't fix it there) but we may be doing something somewhere else that is causing this.

Zooba wrote Sep 5 at 7:36 PM

The other thing to try is simply letting it wait for longer. Because it's a network operation, there should be a timeout at some point, though it may be minutes rather than seconds.

We're looking into an easy fix that will at least defer the hang until project close, rather than having it happen immediately. That way PTVS is at least usable.