Skip to content

Commit

Permalink
Merge pull request #17372 from dpoeschl/SeriouslyDontDeadlockOnSoluti…
Browse files Browse the repository at this point in the history
…onClose

Avoid deadlock on solution close with linked files
  • Loading branch information
dpoeschl authored Feb 28, 2017
2 parents 4f1d215 + bb0ed20 commit 8e26fb9
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/Workspaces/Core/Portable/Workspace/Workspace_Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,7 @@ protected void OnDocumentContextUpdated(DocumentId documentId)

if (container != null)
{
if (_isProjectUnloading.Value)
{
OnDocumentContextUpdated_NoSerializationLock(documentId, container);
}
else
{
OnDocumentContextUpdated(documentId, container);
}
OnDocumentContextUpdated(documentId, container);
}
}

Expand All @@ -345,10 +338,19 @@ protected void OnDocumentContextUpdated(DocumentId documentId)
/// </summary>
internal void OnDocumentContextUpdated(DocumentId documentId, SourceTextContainer container)
{
using (_serializationLock.DisposableWait())
if (_isProjectUnloading.Value)
{
// When the project is unloading, the serialization lock is already taken, so there
// is no need for us to take the lock since everything is already serialized.
OnDocumentContextUpdated_NoSerializationLock(documentId, container);
}
else
{
using (_serializationLock.DisposableWait())
{
OnDocumentContextUpdated_NoSerializationLock(documentId, container);
}
}
}

internal void OnDocumentContextUpdated_NoSerializationLock(DocumentId documentId, SourceTextContainer container)
Expand Down

0 comments on commit 8e26fb9

Please sign in to comment.