Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary finalizers #1209

Merged
merged 7 commits into from
Sep 5, 2024
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
8 changes: 0 additions & 8 deletions src/Renci.SshNet/BaseClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -461,14 +461,6 @@ protected void CheckDisposed()
#endif // NET7_0_OR_GREATER
}

/// <summary>
/// Finalizes an instance of the <see cref="BaseClient"/> class.
/// </summary>
~BaseClient()
{
Dispose(disposing: false);
}

/// <summary>
/// Stops the keep-alive timer, and waits until all timer callbacks have been
/// executed.
Expand Down
8 changes: 0 additions & 8 deletions src/Renci.SshNet/Channels/Channel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -868,13 +868,5 @@ protected virtual void Dispose(bool disposing)
_isDisposed = true;
}
}

/// <summary>
/// Finalizes an instance of the <see cref="Channel"/> class.
/// </summary>
~Channel()
{
Dispose(disposing: false);
}
}
}
9 changes: 0 additions & 9 deletions src/Renci.SshNet/Compression/Compressor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,5 @@ protected virtual void Dispose(bool disposing)
_isDisposed = true;
}
}

/// <summary>
/// Releases unmanaged resources and performs other cleanup operations before the <see cref="Compressor"/> is reclaimed
/// by garbage collection.
/// </summary>
~Compressor()
{
Dispose(disposing: false);
}
}
}
8 changes: 0 additions & 8 deletions src/Renci.SshNet/ForwardedPortRemote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,5 @@ protected override void Dispose(bool disposing)

_isDisposed = true;
}

/// <summary>
/// Finalizes an instance of the <see cref="ForwardedPortRemote"/> class.
/// </summary>
~ForwardedPortRemote()
{
Dispose(disposing: false);
}
}
}
8 changes: 0 additions & 8 deletions src/Renci.SshNet/KeyboardInteractiveAuthenticationMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,5 @@ protected virtual void Dispose(bool disposing)
_isDisposed = true;
}
}

/// <summary>
/// Finalizes an instance of the <see cref="KeyboardInteractiveAuthenticationMethod"/> class.
/// </summary>
~KeyboardInteractiveAuthenticationMethod()
{
Dispose(disposing: false);
}
}
}
8 changes: 0 additions & 8 deletions src/Renci.SshNet/KeyboardInteractiveConnectionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,5 @@ protected virtual void Dispose(bool disposing)
_isDisposed = true;
}
}

/// <summary>
/// Finalizes an instance of the <see cref="KeyboardInteractiveConnectionInfo"/> class.
/// </summary>
~KeyboardInteractiveConnectionInfo()
{
Dispose(disposing: false);
}
}
}
8 changes: 0 additions & 8 deletions src/Renci.SshNet/NoneAuthenticationMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,5 @@ protected virtual void Dispose(bool disposing)
_isDisposed = true;
}
}

/// <summary>
/// Finalizes an instance of the <see cref="NoneAuthenticationMethod"/> class.
/// </summary>
~NoneAuthenticationMethod()
{
Dispose(disposing: false);
}
}
}
8 changes: 0 additions & 8 deletions src/Renci.SshNet/PasswordAuthenticationMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,5 @@ protected virtual void Dispose(bool disposing)
_isDisposed = true;
}
}

/// <summary>
/// Finalizes an instance of the <see cref="PasswordAuthenticationMethod"/> class.
/// </summary>
~PasswordAuthenticationMethod()
{
Dispose(disposing: false);
}
}
}
8 changes: 0 additions & 8 deletions src/Renci.SshNet/PasswordConnectionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,5 @@ protected virtual void Dispose(bool disposing)
_isDisposed = true;
}
}

/// <summary>
/// Finalizes an instance of the <see cref="PasswordConnectionInfo"/> class.
/// </summary>
~PasswordConnectionInfo()
{
Dispose(disposing: false);
}
}
}
8 changes: 0 additions & 8 deletions src/Renci.SshNet/PrivateKeyAuthenticationMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,6 @@ protected virtual void Dispose(bool disposing)
}
}

/// <summary>
/// Finalizes an instance of the <see cref="PrivateKeyAuthenticationMethod"/> class.
/// </summary>
~PrivateKeyAuthenticationMethod()
{
Dispose(disposing: false);
}

private sealed class SignatureData : SshData
{
private readonly RequestMessagePublicKey _message;
Expand Down
8 changes: 0 additions & 8 deletions src/Renci.SshNet/PrivateKeyConnectionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,5 @@ protected virtual void Dispose(bool disposing)
_isDisposed = true;
}
}

/// <summary>
/// Finalizes an instance of the <see cref="PrivateKeyConnectionInfo"/> class.
/// </summary>
~PrivateKeyConnectionInfo()
{
Dispose(disposing: false);
}
}
}
8 changes: 0 additions & 8 deletions src/Renci.SshNet/PrivateKeyFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -669,14 +669,6 @@ protected virtual void Dispose(bool disposing)
}
}

/// <summary>
/// Finalizes an instance of the <see cref="PrivateKeyFile"/> class.
/// </summary>
~PrivateKeyFile()
{
Dispose(disposing: false);
}

private sealed class SshDataReader : SshData
{
public SshDataReader(byte[] data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,5 @@ protected virtual void Dispose(bool disposing)
_isDisposed = true;
}
}

/// <summary>
/// Finalizes an instance of the <see cref="ED25519DigitalSignature"/> class.
/// </summary>
~ED25519DigitalSignature()
{
Dispose(disposing: false);
}
}
}
8 changes: 0 additions & 8 deletions src/Renci.SshNet/Security/Cryptography/ED25519Key.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,5 @@ protected virtual void Dispose(bool disposing)
_isDisposed = true;
}
}

/// <summary>
/// Finalizes an instance of the <see cref="ED25519Key"/> class.
/// </summary>
~ED25519Key()
{
Dispose(disposing: false);
}
}
}
9 changes: 0 additions & 9 deletions src/Renci.SshNet/Security/KeyExchange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -564,15 +564,6 @@ protected virtual void Dispose(bool disposing)
{
}

/// <summary>
/// Releases unmanaged resources and performs other cleanup operations before the
/// <see cref="KeyExchange"/> is reclaimed by garbage collection.
/// </summary>
~KeyExchange()
{
Dispose(disposing: false);
}

#endregion
}
}
8 changes: 0 additions & 8 deletions src/Renci.SshNet/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2253,14 +2253,6 @@ protected virtual void Dispose(bool disposing)
}
}

/// <summary>
/// Finalizes an instance of the <see cref="Session"/> class.
/// </summary>
~Session()
{
Dispose(disposing: false);
}

/// <summary>
/// Gets the connection info.
/// </summary>
Expand Down
5 changes: 0 additions & 5 deletions src/Renci.SshNet/Sftp/SftpFileReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,6 @@ public byte[] Read()
return read;
}

~SftpFileReader()
{
Dispose(disposing: false);
}

public void Dispose()
{
Dispose(disposing: true);
Expand Down
8 changes: 0 additions & 8 deletions src/Renci.SshNet/Sftp/SftpFileStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -439,14 +439,6 @@ internal static async Task<SftpFileStream> OpenAsync(ISftpSession session, strin
return new SftpFileStream(session, path, access, bufferSize, handle, position);
}

/// <summary>
/// Finalizes an instance of the <see cref="SftpFileStream"/> class.
/// </summary>
~SftpFileStream()
{
Dispose(disposing: false);
}

/// <summary>
/// Clears all buffers for this stream and causes any buffered data to be written to the file.
/// </summary>
Expand Down
8 changes: 0 additions & 8 deletions src/Renci.SshNet/Shell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,5 @@ protected virtual void Dispose(bool disposing)
_disposed = true;
}
}

/// <summary>
/// Finalizes an instance of the <see cref="Shell"/> class.
/// </summary>
~Shell()
{
Dispose(disposing: false);
}
}
}
8 changes: 0 additions & 8 deletions src/Renci.SshNet/SubsystemSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -537,14 +537,6 @@ protected virtual void Dispose(bool disposing)
}
}

/// <summary>
/// Finalizes an instance of the <see cref="SubsystemSession" /> class.
/// </summary>
~SubsystemSession()
{
Dispose(disposing: false);
}

private void EnsureNotDisposed()
{
#if NET7_0_OR_GREATER
Expand Down