diff --git a/src/Microsoft.DotNet.Interactive/Connection/MultiplexingKernelCommandAndEventReceiver.cs b/src/Microsoft.DotNet.Interactive/Connection/MultiplexingKernelCommandAndEventReceiver.cs index 4cdfc575fe..a738c95ff1 100644 --- a/src/Microsoft.DotNet.Interactive/Connection/MultiplexingKernelCommandAndEventReceiver.cs +++ b/src/Microsoft.DotNet.Interactive/Connection/MultiplexingKernelCommandAndEventReceiver.cs @@ -57,13 +57,14 @@ public async IAsyncEnumerable CommandsAndEventsAsync([Enumerator await foreach (var commandOrEvent in _source.CommandsAndEventsAsync(cancellationToken)) { - var sources = Array.Empty>(); + BlockingCollection[] sources; lock (_children) { sources = _children.Select(c => c.LocalStorage).ToArray(); } - if (_children.Count > 0) + + if (sources.Length > 0) { foreach (var destination in sources) {