Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Microsoft.DotNet.Interactive.Jupyter
public static System.String input(System.String prompt = )
public static Microsoft.DotNet.Interactive.PasswordString password(System.String prompt = )
Microsoft.DotNet.Interactive.Jupyter.Connection
public abstract class IJupyterConnection, System.IDisposable
public abstract class IJupyterConnection
public System.Threading.Tasks.Task<IJupyterKernelConnection> CreateKernelConnectionAsync(System.String kernelSpecName)
public System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.DotNet.Interactive.Jupyter.KernelSpec>> GetKernelSpecsAsync()
public abstract class IJupyterKernelConnection, System.IDisposable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public async Task StartAsync()
public bool IsDisposed => _disposed;
}

public class TestJupyterConnection : IJupyterConnection
public class TestJupyterConnection : IJupyterConnection, IDisposable
{
private IJupyterConnection _testJupyterConnection;
private TestJupyterKernelConnection _testKernelConnection;
Expand Down Expand Up @@ -254,7 +254,7 @@ public async Task<IJupyterKernelConnection> CreateKernelConnectionAsync(string k

public void Dispose()
{
_testJupyterConnection?.Dispose();
(_testJupyterConnection as IDisposable)?.Dispose();
_disposed = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ public override async Task<Kernel> ConnectKernelAsync(
var localName = commandLineContext.ParseResult.GetValueForOption(KernelNameOption);

var kernel = await connector?.CreateKernelAsync(localName);
kernel?.RegisterForDisposal(connection);
if (connection is IDisposable disposableConnection)
{
kernel?.RegisterForDisposal(disposableConnection);
}
return kernel;
}

Expand All @@ -95,8 +98,8 @@ private IEnumerable<CompletionItem> GetKernelSpecsCompletions(CompletionContext
}

IEnumerable<CompletionItem> completions;
using (var connection = GetJupyterConnection(ctx.ParseResult))
{
var connection = GetJupyterConnection(ctx.ParseResult);
using (connection as IDisposable) {
completions = GetKernelSpecsCompletions(connection);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Microsoft.DotNet.Interactive.Jupyter.Connection;

public interface IJupyterConnection : IDisposable
public interface IJupyterConnection
{
Task<IEnumerable<KernelSpec>> GetKernelSpecsAsync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Microsoft.DotNet.Interactive.Jupyter.Http;

internal class JupyterHttpConnection : IJupyterConnection
internal class JupyterHttpConnection : IJupyterConnection, IDisposable
{
#region JsonTypes
private class KernelSessionInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,6 @@ private Process CreateKernelProcess(KernelSpec spec, string connectionFilePath)
return kernelProcess;
}

public void Dispose()
{
}

private async Task<KernelSpec> GetKernelSpecAsync(string kernelSpecName)
{
var installedSpecs = await _getKernelSpecs;
Expand Down