dotnet / project-system

The .NET Project System for Visual Studio
MIT License
971 stars 389 forks source link

VS Hangs when you Create new Core Console App, Close Solution, Open Solution and Close Solution #777

Closed basoundr closed 8 years ago

basoundr commented 8 years ago

Repro: VS Build D15PreRel 15.0.25918.0

  1. Create a new Core Console App
  2. Close Solution(not VS)
  3. Open the previously created solution
  4. Close Solution

    VS Hangs with a message saying Unloading the project and after a while crashes.

basoundr commented 8 years ago

This repro with a previously created project as well. Does not need to be a newly created project

Update: This is worse than I thought. Even F5 does not work. It seems like when you close a solution and open the same solution then VS gets into a bad state.

davkean commented 8 years ago

Installing that build to get to the bottom of this.

davkean commented 8 years ago

I can repro this consistently, it's some sort of deadlock closing the hierarchy:

Here's the main thread:

    ntdll.dll!_ZwWaitForMultipleObjects@20() Line 821   Unknown
    KernelBase.dll!770a1a60()   Unknown
    [Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll]    
    ntdll.dll!_ZwRaiseException@12() Line 2805  Unknown
    ntdll.dll!_RtlRaiseException@4() Line 167   Unknown
    Microsoft.VisualStudio.Threading.ni.dll!77a25ad2()  Unknown
    Microsoft.VisualStudio.Threading.ni.dll!77a25ad2()  Unknown
    [Managed to Native Transition]  
    Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.NoMessagePumpSyncContext.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.Monitor.Wait(object obj, int millisecondsTimeout, bool exitContext)   Unknown
    mscorlib.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout) Unknown
    mscorlib.dll!System.Threading.ManualResetEventSlim.Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)  Unknown
    mscorlib.dll!System.Threading.Tasks.Task.SpinThenBlockingWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)    Unknown
    mscorlib.dll!System.Threading.Tasks.Task.InternalWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)    Unknown
    mscorlib.dll!System.Threading.Tasks.Task.Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)    Unknown
    mscorlib.dll!System.Threading.Tasks.Task.Wait(System.TimeSpan timeout)  Unknown
    Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.WaitSynchronouslyCore(System.Threading.Tasks.Task task)   Unknown
    Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.WaitSynchronously(System.Threading.Tasks.Task task)   Unknown
    Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()    Unknown
    Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTask<Microsoft.VisualStudio.ProjectSystem.VS.HResult>.CompleteOnCurrentThread()   Unknown
>   Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.Run<Microsoft.VisualStudio.ProjectSystem.VS.HResult>(System.Func<System.Threading.Tasks.Task<Microsoft.VisualStudio.ProjectSystem.VS.HResult>> asyncMethod, Microsoft.VisualStudio.Threading.JoinableTaskCreationOptions creationOptions) Unknown
    Microsoft.VisualStudio.ProjectSystem.Implementation.dll!Microsoft.VisualStudio.ProjectSystem.ProjectMultiThreadedService.ExecuteSynchronously<Microsoft.VisualStudio.ProjectSystem.VS.HResult>(System.Func<System.Threading.Tasks.Task<Microsoft.VisualStudio.ProjectSystem.VS.HResult>> asyncAction)   Unknown
    Microsoft.VisualStudio.ProjectSystem.VS.Implementation.dll!Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.HrInvoke.AnonymousMethod__0() Unknown
    Microsoft.VisualStudio.ProjectSystem.VS.dll!Microsoft.VisualStudio.ProjectSystem.VS.HResult.Invoke(System.Func<Microsoft.VisualStudio.ProjectSystem.VS.HResult> action, System.IServiceProvider vsShellServiceProvider, Microsoft.VisualStudio.ProjectSystem.IProjectFaultHandlerService projectFaultHandlerService, Microsoft.VisualStudio.ProjectSystem.UnconfiguredProject project)  Unknown
    Microsoft.VisualStudio.ProjectSystem.VS.Implementation.dll!Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.HrInvoke(System.Func<System.Threading.Tasks.Task<Microsoft.VisualStudio.ProjectSystem.VS.HResult>> asyncAction, bool registerProjectFaultHandlerService)  Unknown
    Microsoft.VisualStudio.ProjectSystem.VS.Implementation.dll!Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.Close()   Unknown

I had a look at it, and there's nothing obvious (to me) that stands out here, @lifengl do you mind taking a look? There's not much on the other threads, I can't see anything obvious:

\mlangfs1\public\davkean\777\devenv.dmp

mavasani commented 8 years ago

Seems very similar to https://github.com/dotnet/roslyn-project-system/issues/712

lifengl commented 8 years ago

I will take a look.

Sent from my phone

On Nov 20, 2016, at 9:28 PM, David Kean notifications@github.com<mailto:notifications@github.com> wrote:

I can repro this consistently, it's some sort of deadlock closing the hierarchy:

Here's the main thread:

    ntdll.dll!_ZwWaitForMultipleObjects@20() Line 821       Unknown
    KernelBase.dll!770a1a60()       Unknown
    [Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll]
    ntdll.dll!_ZwRaiseException@12() Line 2805      Unknown
    ntdll.dll!_RtlRaiseException@4() Line 167       Unknown
    Microsoft.VisualStudio.Threading.ni.dll!77a25ad2()      Unknown
    Microsoft.VisualStudio.Threading.ni.dll!77a25ad2()      Unknown
    [Managed to Native Transition]
    Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.NoMessagePumpSyncContext.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.Monitor.Wait(object obj, int millisecondsTimeout, bool exitContext)       Unknown
    mscorlib.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout) Unknown
    mscorlib.dll!System.Threading.ManualResetEventSlim.Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)  Unknown
    mscorlib.dll!System.Threading.Tasks.Task.SpinThenBlockingWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)    Unknown
    mscorlib.dll!System.Threading.Tasks.Task.InternalWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)    Unknown
    mscorlib.dll!System.Threading.Tasks.Task.Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)    Unknown
    mscorlib.dll!System.Threading.Tasks.Task.Wait(System.TimeSpan timeout)  Unknown
    Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.WaitSynchronouslyCore(System.Threading.Tasks.Task task)       Unknown
    Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.WaitSynchronously(System.Threading.Tasks.Task task)   Unknown
    Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()    Unknown
    Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTask<Microsoft.VisualStudio.ProjectSystem.VS.HResult>.CompleteOnCurrentThread()   Unknown
  Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.Run<Microsoft.VisualStudio.ProjectSystem.VS.HResult>(System.Func<System.Threading.Tasks.Task<Microsoft.VisualStudio.ProjectSystem.VS.HResult>> asyncMethod, Microsoft.VisualStudio.Threading.JoinableTaskCreationOptions creationOptions)     Unknown
    Microsoft.VisualStudio.ProjectSystem.Implementation.dll!Microsoft.VisualStudio.ProjectSystem.ProjectMultiThreadedService.ExecuteSynchronously<Microsoft.VisualStudio.ProjectSystem.VS.HResult>(System.Func<System.Threading.Tasks.Task<Microsoft.VisualStudio.ProjectSystem.VS.HResult>> asyncAction)   Unknown
    Microsoft.VisualStudio.ProjectSystem.VS.Implementation.dll!Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.HrInvoke.AnonymousMethod__0()     Unknown
    Microsoft.VisualStudio.ProjectSystem.VS.dll!Microsoft.VisualStudio.ProjectSystem.VS.HResult.Invoke(System.Func<Microsoft.VisualStudio.ProjectSystem.VS.HResult> action, System.IServiceProvider vsShellServiceProvider, Microsoft.VisualStudio.ProjectSystem.IProjectFaultHandlerService projectFaultHandlerService, Microsoft.VisualStudio.ProjectSystem.UnconfiguredProject project)  Unknown
    Microsoft.VisualStudio.ProjectSystem.VS.Implementation.dll!Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.HrInvoke(System.Func<System.Threading.Tasks.Task<Microsoft.VisualStudio.ProjectSystem.VS.HResult>> asyncAction, bool registerProjectFaultHandlerService)  Unknown
    Microsoft.VisualStudio.ProjectSystem.VS.Implementation.dll!Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.Close()   Unknown

I had a look at it, and there's nothing obvious (to me) that stands out here, @lifenglhttps://github.com/lifengl do you mind taking a look? There's not much on the other threads, I can't see anything obvious:

\mlangfs1\public\davkean\777\devenv.dmp

You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/roslyn-project-system/issues/777#issuecomment-261846966, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALGWwnubDI6E22BsGeVfBujjwWobKqzgks5rASvugaJpZM4K3DMi.

davkean commented 8 years ago

I hit this on any unload of the project, including just shutting down Visual Studio.

lifengl commented 8 years ago

That is the same dead lock bug in the Nuget restore engine last Friday. Bill caught two dumps. This is not the MEF one they fixed today. Maybe take another look tomorrow. Laptop screen is too small to read traces.

I noticed that we do have another dead lock related to the data flow when closing a project, which is different from this one. Andrew got one dump file, which I am looking into now.

Sent from my phone

On Nov 21, 2016, at 7:26 PM, David Kean notifications@github.com<mailto:notifications@github.com> wrote:

I hit this on any unload of the project, including just shutting down Visual Studio.

You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/roslyn-project-system/issues/777#issuecomment-262137787, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALGWwiNjZSoBZ3P7Ub6DSFx8beUW3Jfwks5rAmDkgaJpZM4K3DMi.

jinujoseph commented 8 years ago

Doesn't repro any more , verified on d15prerel/25929.3