Skip to content

Commit

Permalink
move assert
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrusNajmabadi committed Mar 29, 2024
1 parent 161f12a commit f05dee1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Workspaces/Core/Portable/Workspace/Workspace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,16 +324,16 @@ static Solution UnifyLinkedDocumentContents(Solution oldSolution, Solution newSo
// to be recreated for each document.
var relatedDocumentId = solution.GetFirstRelatedDocumentId(addedDocumentId, relatedProjectIdHint);

// Should never return a file as its own related document
Contract.ThrowIfTrue(relatedDocumentId == addedDocumentId);

// Couldn't find a related document. Keep the same solution, and keep track of the best related project we
// found while processing this project.
if (relatedDocumentId is null)
return (solution, relatedProjectIdHint);

var relatedDocument = solution.GetRequiredDocument(relatedDocumentId);

// Should never return a file as its own related document
Contract.ThrowIfTrue(relatedDocumentId == addedDocumentId);

// Related document must come from a distinct project.
Contract.ThrowIfTrue(relatedDocumentId.ProjectId == addedDocumentId.ProjectId);

Expand Down

0 comments on commit f05dee1

Please sign in to comment.