Skip to content

Commit

Permalink
try only parenting on same command type
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsequitur committed Dec 21, 2023
1 parent ad30ce6 commit 1c4ca0c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Microsoft.DotNet.Interactive/Commands/KernelCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ public void SetParent(KernelCommand parent, bool bubbleEvents = false)
throw new ArgumentNullException(nameof(parent));
}

if (_token is not null)
{
// FIX: (SetParent)
if (parent._token is null)
{
}
else if (GetRootToken(_token) != GetRootToken(parent._token))
{
throw new InvalidOperationException("Parent cannot be changed.");
}
}

if (_parent is null)
{
_parent = parent;
Expand Down

0 comments on commit 1c4ca0c

Please sign in to comment.