It happens a couple of times per day. The deadlock happens before files are written to disk so work is lost.
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFrameworks>net45;netcoreapp3.0</TargetFrameworks>
<UseWpf>true</UseWpf>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
Don't have much info other than that this bug showed up in 16.4 and a suspicion that it might have something to do with multitargeted WPF control libraries.
I have tried waiting 30 minutes but no dice.
I encountered deadlogs aswell, while working with a multitargetting wpf project. Especially easy to reproduce, when i open a solution and immediately hit the save button in VS.
Other times I have seen it happen is when editing project files in the xml editor.
Have had issues when saving after moving files, and fixing namespaces in multiple .NET Framework and .NET Standard class libraries in a solution with WPF projects (not sure that matters). VS locks up and stops responding.
I've run into this myself. @jinujoseph this may be another report of hte hang i reported here: https://github.com/dotnet/roslyn/issues/40233
Note: this issue is critical as it does lead to data-loss.
I've experienced this deadlock on two projects. The first is a WPF project that multi-targets net47 and netcoreapp3.0. The second is a WPF project that targets net462.
It was on a multi project solution for me, where i was targetting net461;netcoreapp3.0, netcoreapp3.0 and netstandard2.0 in separate projects. It can be found here. I encountered it also on a project that was only targetting net472 at work. All of them were using the new project style format.
@JohanLarsson Can you file an issue on developer community for this? The instructions for this type of hang can be found here:
https://docs.microsoft.com/en-us/visualstudio/ide/how-to-increase-chances-of-performance-issue-being-fixed?view=vs-2019#unresponsiveness
I'll try to remember to fire up another instance and report. Didn't know that option existed.
@sharwell recorded and reported now.
@sharwell Reported issue by johan is here: https://developercommunity.visualstudio.com/content/problem/852667/visual-studio-hangs-forever-when-saving-files.html
Johan, can you include the repro steps you identified in our gitter chat?
@mavasani Can you take a look ? Ths is a significant data loss issue as this literally happens during save. So users explicitly lose whatever they were working on and the product must be killed/restarted.
Repro using 16.4.2

@mavasani and @sharwell , @JohanLarsson has linked to vsfeedback issue containing the traces here. can you look asap. this is a data-loss and complete product hang issue.
tagging @jinujoseph @vatsalyaagrawal for visbility. This was reported nearly two weeks ago, but has no one assigned to it.
Milestone was also put at 'backlog', even though this should be a pri0 issue looked into immediately.
Investigating..
@JohanLarsson I noticed from the report that you have 16.4.1 installed. Can you also try to quickly upgrade to 16.4.2, in case it is same issue as https://github.com/dotnet/roslyn/issues/40455#issuecomment-566851545?
Repro with 16.4.1 and 16.4.2
@mavasani he also reproed it on 16.4.2 as per gitter and https://github.com/dotnet/roslyn/issues/40241#issuecomment-567700873
@JohanLarsson will also be linking to a direct 32bit dump produced from devenv.
Looks like a dupe of https://github.com/Xavalon/XamlStyler/issues/216
UI thread:
win32u.dll!_NtUserMsgWaitForMultipleObjectsEx@20
() Unknown
user32.dll!763adfd9() Unknown
user32.dll![Frames below may be incorrect and/or missing, no symbols loaded for user32.dll] Unknown
user32.dll!763adf0d() Unknown
msenv.dll!ATL::AtlInternalQueryInterface(void *,struct ATL::_ATL_INTMAP_ENTRY const *,struct _GUID const &,void * *) Unknown
msenv.dll!CPropertiesImpl::IsOnlyReferencedByItsChildrenAndViceVersa(void) Unknown
[Waiting on lock owned by Thread 23264]
[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]
System.dll!System.ComponentModel.Container.Components.get() Line 165 C#
> Microsoft.VisualStudio.Shell.15.0.dll!Microsoft.VisualStudio.Shell.Package.GetDialogPage(System.Type dialogPageType) Unknown
XamlStyler3.Package.dll!Xavalon.XamlStyler3.Package.StylerPackage.Execute(EnvDTE.Document document) Unknown
XamlStyler3.Package.dll!Xavalon.XamlStyler3.Package.StylerPackage.OnFileSaveAllBeforeExecute.AnonymousMethod__9_0(EnvDTE.Document document) Unknown
mscorlib.dll!System.Threading.Tasks.Parallel.ForEachWorker.AnonymousMethod__0(int i) Unknown
mscorlib.dll!System.Threading.Tasks.Parallel.ForWorker.AnonymousMethod__1() Unknown
mscorlib.dll!System.Threading.Tasks.Task.InnerInvoke() Unknown
mscorlib.dll!System.Threading.Tasks.Task.InnerInvokeWithArg(System.Threading.Tasks.Task childTask) Unknown
mscorlib.dll!System.Threading.Tasks.Task.ExecuteSelfReplicating.AnonymousMethod__0(object <p0>) Unknown
mscorlib.dll!System.Threading.Tasks.Task.ExecuteSelfReplicating(System.Threading.Tasks.Task root) 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.ThreadPoolTaskScheduler.TryExecuteTaskInline(System.Threading.Tasks.Task task, bool taskWasPreviouslyQueued) Unknown
mscorlib.dll!System.Threading.Tasks.TaskScheduler.TryRunInline(System.Threading.Tasks.Task task, bool taskWasPreviouslyQueued) Unknown
mscorlib.dll!System.Threading.Tasks.Task.InternalRunSynchronously(System.Threading.Tasks.TaskScheduler scheduler, bool waitForCompletion) Unknown
mscorlib.dll!System.Threading.Tasks.Task.RunSynchronously(System.Threading.Tasks.TaskScheduler scheduler) Unknown
mscorlib.dll!System.Threading.Tasks.Parallel.ForWorker<object>(int fromInclusive, int toExclusive, System.Threading.Tasks.ParallelOptions parallelOptions, System.Action<int> body, System.Action<int, System.Threading.Tasks.ParallelLoopState> bodyWithState, System.Func<int, System.Threading.Tasks.ParallelLoopState, object, object> bodyWithLocal, System.Func<object> localInit, System.Action<object> localFinally) Unknown
mscorlib.dll!System.Threading.Tasks.Parallel.ForEachWorker<EnvDTE.Document, object>(System.Collections.Generic.IList<EnvDTE.Document> list, System.Threading.Tasks.ParallelOptions parallelOptions, System.Action<EnvDTE.Document> body, System.Action<EnvDTE.Document, System.Threading.Tasks.ParallelLoopState> bodyWithState, System.Action<EnvDTE.Document, System.Threading.Tasks.ParallelLoopState, long> bodyWithStateAndIndex, System.Func<EnvDTE.Document, System.Threading.Tasks.ParallelLoopState, object, object> bodyWithStateAndLocal, System.Func<EnvDTE.Document, System.Threading.Tasks.ParallelLoopState, long, object, object> bodyWithEverything, System.Func<object> localInit, System.Action<object> localFinally) Unknown
mscorlib.dll!System.Threading.Tasks.Parallel.ForEachWorker<EnvDTE.Document, object>(System.Collections.Generic.IEnumerable<EnvDTE.Document> source, System.Threading.Tasks.ParallelOptions parallelOptions, System.Action<EnvDTE.Document> body, System.Action<EnvDTE.Document, System.Threading.Tasks.ParallelLoopState> bodyWithState, System.Action<EnvDTE.Document, System.Threading.Tasks.ParallelLoopState, long> bodyWithStateAndIndex, System.Func<EnvDTE.Document, System.Threading.Tasks.ParallelLoopState, object, object> bodyWithStateAndLocal, System.Func<EnvDTE.Document, System.Threading.Tasks.ParallelLoopState, long, object, object> bodyWithEverything, System.Func<object> localInit, System.Action<object> localFinally) Unknown
mscorlib.dll!System.Threading.Tasks.Parallel.ForEach<EnvDTE.Document>(System.Collections.Generic.IEnumerable<EnvDTE.Document> source, System.Action<EnvDTE.Document> body) Unknown
XamlStyler3.Package.dll!Xavalon.XamlStyler3.Package.StylerPackage.OnFileSaveAllBeforeExecute(string guid, int id, object customIn, object customOut, ref bool cancelDefault) Unknown
EnvDTE.dll!EnvDTE._dispCommandEvents_SinkHelper.BeforeExecute(string A_1, int A_2, object A_3, object A_4, ref bool A_5) Unknown
@JohanLarsson Fine with me closing this as external?
Ah, thanks!
Thanks for the quick workaround @mavasani !