# < Summary

Information

Class: | Renci.SshNet.Common.SshConnectionException
Assembly: | Renci.SshNet
File(s): | \home\appveyor\projects\ssh-net\src\Renci.SshNet\Common\SshConnectionException.cs

Line coverage
69%

Covered lines: | 16
Uncovered lines: | 7
Coverable lines: | 23
Total lines: | 87
Line coverage: | 69.5%

Branch coverage
N/A

Covered branches: | 0
Total branches: | 0
Branch coverage: | N/A

Method coverage

Feature is only available for sponsors

Upgrade to PRO version

# Metrics

Method | Branch coverage | Cyclomatic complexity | Line coverage
--- | --- | --- | ---
get_DisconnectReason() | 100% | 1 | 100%
.ctor() | 100% | 1 | 100%
.ctor(...) | 100% | 1 | 100%
.ctor(...) | 100% | 1 | 100%
.ctor(...) | 100% | 1 | 0%
.ctor(...) | 100% | 1 | 100%
.ctor(...) | 100% | 1 | 0%

# File(s)

## \home\appveyor\projects\ssh-net\src\Renci.SshNet\Common\SshConnectionException.cs

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using System;`
|  | `2` |  | `#if FEATURE_BINARY_SERIALIZATION`
|  | `3` |  | `using System.Runtime.Serialization;`
|  | `4` |  | `#endif // FEATURE_BINARY_SERIALIZATION`
|  | `5` |  | `using Renci.SshNet.Messages.Transport;`
|  | `6` |  | ``
|  | `7` |  | `namespace Renci.SshNet.Common`
|  | `8` |  | `{`
|  | `9` |  | `/// <summary>`
|  | `10` |  | `/// The exception that is thrown when connection was terminated.`
|  | `11` |  | `/// </summary>`
|  | `12` |  | `#if FEATURE_BINARY_SERIALIZATION`
|  | `13` |  | `[Serializable]`
|  | `14` |  | `#endif // FEATURE_BINARY_SERIALIZATION`
|  | `15` |  | `public class SshConnectionException : SshException`
|  | `16` |  | `{`
|  | `17` |  | `/// <summary>`
|  | `18` |  | `/// Gets the disconnect reason if provided by the server or client. Otherwise None.`
|  | `19` |  | `/// </summary>`
| 2618 | `20` |  | `public DisconnectReason DisconnectReason { get; private set; }`
|  | `21` |  | ``
|  | `22` |  | `/// <summary>`
|  | `23` |  | `/// Initializes a new instance of the <see cref="SshConnectionException"/> class.`
|  | `24` |  | `/// </summary>`
| 54 | `25` |  | `public SshConnectionException()`
| 54 | `26` |  | `{`
| 54 | `27` |  | `}`
|  | `28` |  | ``
|  | `29` |  | `/// <summary>`
|  | `30` |  | `/// Initializes a new instance of the <see cref="SshConnectionException"/> class.`
|  | `31` |  | `/// </summary>`
|  | `32` |  | `/// <param name="message">The message.</param>`
|  | `33` |  | `public SshConnectionException(string message)`
| 242 | `34` |  | `: base(message)`
| 242 | `35` |  | `{`
| 242 | `36` |  | `DisconnectReason = DisconnectReason.None;`
| 242 | `37` |  | `}`
|  | `38` |  | ``
|  | `39` |  | `/// <summary>`
|  | `40` |  | `/// Initializes a new instance of the <see cref="SshConnectionException"/> class.`
|  | `41` |  | `/// </summary>`
|  | `42` |  | `/// <param name="message">The message.</param>`
|  | `43` |  | `/// <param name="disconnectReasonCode">The disconnect reason code.</param>`
|  | `44` |  | `public SshConnectionException(string message, DisconnectReason disconnectReasonCode)`
| 1966 | `45` |  | `: base(message)`
| 1966 | `46` |  | `{`
| 1966 | `47` |  | `DisconnectReason = disconnectReasonCode;`
| 1966 | `48` |  | `}`
|  | `49` |  | ``
|  | `50` |  | `/// <summary>`
|  | `51` |  | `/// Initializes a new instance of the <see cref="SshConnectionException"/> class.`
|  | `52` |  | `/// </summary>`
|  | `53` |  | `/// <param name="message">The message.</param>`
|  | `54` |  | `/// <param name="inner">The inner.</param>`
|  | `55` |  | `public SshConnectionException(string message, Exception inner)`
| 0 | `56` |  | `: base(message, inner)`
| 0 | `57` |  | `{`
| 0 | `58` |  | `DisconnectReason = DisconnectReason.None;`
| 0 | `59` |  | `}`
|  | `60` |  | ``
|  | `61` |  | `/// <summary>`
|  | `62` |  | `/// Initializes a new instance of the <see cref="SshConnectionException"/> class.`
|  | `63` |  | `/// </summary>`
|  | `64` |  | `/// <param name="message">The message.</param>`
|  | `65` |  | `/// <param name="disconnectReasonCode">The disconnect reason code.</param>`
|  | `66` |  | `/// <param name="inner">The inner.</param>`
|  | `67` |  | `public SshConnectionException(string message, DisconnectReason disconnectReasonCode, Exception inner)`
| 16 | `68` |  | `: base(message, inner)`
| 16 | `69` |  | `{`
| 16 | `70` |  | `DisconnectReason = disconnectReasonCode;`
| 16 | `71` |  | `}`
|  | `72` |  | ``
|  | `73` |  | `#if FEATURE_BINARY_SERIALIZATION`
|  | `74` |  | `/// <summary>`
|  | `75` |  | `/// Initializes a new instance of the <see cref="SshConnectionException"/> class.`
|  | `76` |  | `/// </summary>`
|  | `77` |  | `/// <param name="info">The <see cref="SerializationInfo"/> that holds the serialized object data about the excep`
|  | `78` |  | `/// <param name="context">The <see cref="StreamingContext"/> that contains contextual information about the sour`
|  | `79` |  | `/// <exception cref="ArgumentNullException">The <paramref name="info"/> parameter is <see langword="null"/>.</ex`
|  | `80` |  | `/// <exception cref="SerializationException">The class name is <see langword="null"/> or <see cref="Exception.HR`
|  | `81` |  | `protected SshConnectionException(SerializationInfo info, StreamingContext context)`
| 0 | `82` |  | `: base(info, context)`
| 0 | `83` |  | `{`
| 0 | `84` |  | `}`
|  | `85` |  | `#endif // FEATURE_BINARY_SERIALIZATION`
|  | `86` |  | `}`
|  | `87` |  | `}`

# Methods/Properties

get_DisconnectReason()
.ctor()
.ctor(System.String)
.ctor(System.String,Renci.SshNet.Messages.Transport.DisconnectReason)
.ctor(System.String,System.Exception)
.ctor(System.String,Renci.SshNet.Messages.Transport.DisconnectReason,System.Exception)
.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)