Skip to content

Invoking ISftpClient.Dispose() results in [CS0121] compile error #1239

Closed
@hthroweriii

Description

@hthroweriii

Version: 2023.0.0

Problem

Directly invoking ISftpClient.Dispose() results in the following error:

[CS0121] The call is ambiguous between the following methods or properties: 'Renci.SshNet.IBaseClient.Dispose()' and 'System.IDisposable.Dispose()'

The following displays sample code to reproduce the compile time error.

ISftpClient sftpClient = new SftpClient(host, port, username, password);
sftpClient.Dispose(); //This line results in the [CS0121] error

Current Workaround

ISftpClient sftpClient = new SftpClient(host, port, username, password);
((IDisposable)sftpClient).Dispose(); 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions