diff --git a/src/client/datascience/jupyter/liveshare/hostJupyterServer.ts b/src/client/datascience/jupyter/liveshare/hostJupyterServer.ts index cec3de412ca8..e893f12a0c90 100644 --- a/src/client/datascience/jupyter/liveshare/hostJupyterServer.ts +++ b/src/client/datascience/jupyter/liveshare/hostJupyterServer.ts @@ -158,10 +158,16 @@ export class HostJupyterServer extends LiveShareParticipantHost(JupyterServerBas // Otherwise create a new notebook. // First we need our launch information so we can start a new session (that's what our notebook is really) - const launchInfo = await this.waitForConnect(); + let launchInfo = await this.waitForConnect(); if (!launchInfo) { throw this.getDisposedError(); } + // Create a copy of launch info, cuz we're modifying it here. + // This launch info contains the server connection info (that could be shared across other nbs). + // However the kernel info is different. The kernel info is stored as a property of this, hence create a separate instance for each nb. + launchInfo = { + ...launchInfo + }; // Find a kernel that can be used. // Do this only if kernel information has been provided in the metadata, else use the default.