Răsfoiți Sursa

Remove old features [Part 1] (#1117)

Remove obsolete feature switches (now that we've remove support for legacy target frameworks) and remove corresponding conditional code.
Wojciech Nagórski 2 ani în urmă
părinte
comite
8c932fb1e8
79 a modificat fișierele cu 60 adăugiri și 1353 ștergeri
  1. 0 3
      src/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs
  2. 0 3
      src/Renci.SshNet.Tests/Classes/Common/CountdownEventTest.cs
  3. 0 4
      src/Renci.SshNet.Tests/Classes/Common/CountdownEventTest_Dispose_NotSet.cs
  4. 0 4
      src/Renci.SshNet.Tests/Classes/Common/CountdownEventTest_Dispose_Set.cs
  5. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamAsyncTestBase.cs
  6. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileAccessInvalid.cs
  7. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessRead.cs
  8. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessReadWrite.cs
  9. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessWrite.cs
  10. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreateNew_FileAccessRead.cs
  11. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreateNew_FileAccessReadWrite.cs
  12. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreateNew_FileAccessWrite.cs
  13. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessRead.cs
  14. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileDoesNotExist.cs
  15. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileExists.cs
  16. 2 4
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessWrite_FileDoesNotExist.cs
  17. 2 4
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessWrite_FileExists.cs
  18. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeInvalid.cs
  19. 2 4
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessRead.cs
  20. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessReadWrite.cs
  21. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessWrite.cs
  22. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessRead.cs
  23. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessReadWrite.cs
  24. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessWrite.cs
  25. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessRead.cs
  26. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessReadWrite.cs
  27. 2 4
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessWrite.cs
  28. 2 4
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndEqualToBufferSize.cs
  29. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndLessThanBufferSize.cs
  30. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadMoreBytesFromServerThanCount.cs
  31. 1 3
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_WriteAsync_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs
  32. 2 4
      src/Renci.SshNet.Tests/Classes/SftpClientTest.ConnectAsync.cs
  33. 2 4
      src/Renci.SshNet.Tests/Classes/SftpClientTest.DeleteFileAsync.cs
  34. 1 3
      src/Renci.SshNet.Tests/Classes/SftpClientTest.RenameFileAsync.cs
  35. 0 3
      src/Renci.SshNet.Tests/Common/AsyncSocketListener.cs
  36. 1 1
      src/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj
  37. 0 129
      src/Renci.SshNet/Abstractions/CryptoAbstraction.cs
  38. 0 7
      src/Renci.SshNet/Abstractions/DiagnosticAbstraction.cs
  39. 0 6
      src/Renci.SshNet/Abstractions/DnsAbstraction.cs
  40. 0 8
      src/Renci.SshNet/Abstractions/ReflectionAbstraction.cs
  41. 2 359
      src/Renci.SshNet/Abstractions/SocketAbstraction.cs
  42. 1 3
      src/Renci.SshNet/Abstractions/SocketExtensions.cs
  43. 0 19
      src/Renci.SshNet/Abstractions/ThreadAbstraction.cs
  44. 1 6
      src/Renci.SshNet/BaseClient.cs
  45. 0 167
      src/Renci.SshNet/Common/ASCIIEncoding.cs
  46. 0 171
      src/Renci.SshNet/Common/CountdownEvent.cs
  47. 0 60
      src/Renci.SshNet/Common/Extensions.cs
  48. 2 6
      src/Renci.SshNet/Common/PacketDump.cs
  49. 1 4
      src/Renci.SshNet/Common/SshData.cs
  50. 0 6
      src/Renci.SshNet/Common/SshDataStream.cs
  51. 0 7
      src/Renci.SshNet/Connection/ConnectorBase.cs
  52. 0 2
      src/Renci.SshNet/Connection/DirectConnector.cs
  53. 0 2
      src/Renci.SshNet/Connection/IConnector.cs
  54. 0 2
      src/Renci.SshNet/Connection/IProtocolVersionExchange.cs
  55. 0 11
      src/Renci.SshNet/Connection/ProtocolVersionExchange.cs
  56. 2 10
      src/Renci.SshNet/Connection/ProxyConnector.cs
  57. 0 4
      src/Renci.SshNet/Connection/Socks4Connector.cs
  58. 0 2
      src/Renci.SshNet/ConnectionInfo.cs
  59. 0 4
      src/Renci.SshNet/IBaseClient.cs
  60. 0 4
      src/Renci.SshNet/ISession.cs
  61. 0 13
      src/Renci.SshNet/ISftpClient.cs
  62. 0 3
      src/Renci.SshNet/NoneAuthenticationMethod.cs
  63. 1 8
      src/Renci.SshNet/PrivateKeyFile.cs
  64. 2 2
      src/Renci.SshNet/Renci.SshNet.csproj
  65. 0 10
      src/Renci.SshNet/Security/BouncyCastle/crypto/prng/CryptoApiRandomGenerator.cs
  66. 2 6
      src/Renci.SshNet/Security/Cryptography/Bcrypt.cs
  67. 1 3
      src/Renci.SshNet/Security/Cryptography/EcdsaDigitalSignature.cs
  68. 1 3
      src/Renci.SshNet/Security/Cryptography/EcdsaKey.cs
  69. 1 5
      src/Renci.SshNet/Security/Cryptography/HMACMD5.cs
  70. 1 5
      src/Renci.SshNet/Security/Cryptography/HMACSHA1.cs
  71. 1 5
      src/Renci.SshNet/Security/Cryptography/HMACSHA256.cs
  72. 1 5
      src/Renci.SshNet/Security/Cryptography/HMACSHA384.cs
  73. 1 5
      src/Renci.SshNet/Security/Cryptography/HMACSHA512.cs
  74. 0 67
      src/Renci.SshNet/Session.cs
  75. 0 24
      src/Renci.SshNet/Sftp/ISftpSession.cs
  76. 1 12
      src/Renci.SshNet/Sftp/SftpFileStream.cs
  77. 0 31
      src/Renci.SshNet/Sftp/SftpSession.cs
  78. 0 14
      src/Renci.SshNet/SftpClient.cs
  79. 0 18
      src/Renci.SshNet/Shell.cs

+ 0 - 3
src/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs

@@ -5,9 +5,6 @@ using System.Net.Sockets;
 using System.Threading;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Moq;
-#if !FEATURE_SOCKET_DISPOSE
-using Renci.SshNet.Common;
-#endif // !FEATURE_SOCKET_DISPOSE
 using Renci.SshNet.Channels;
 using Renci.SshNet.Messages.Connection;
 using Renci.SshNet.Tests.Common;

+ 0 - 3
src/Renci.SshNet.Tests/Classes/Common/CountdownEventTest.cs

@@ -2,9 +2,6 @@
 using System.Diagnostics;
 using System.Threading;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
-#if !FEATURE_THREAD_COUNTDOWNEVENT
-using CountdownEvent = Renci.SshNet.Common.CountdownEvent;
-#endif
 
 namespace Renci.SshNet.Tests.Classes.Common
 {

+ 0 - 4
src/Renci.SshNet.Tests/Classes/Common/CountdownEventTest_Dispose_NotSet.cs

@@ -1,10 +1,6 @@
 using System;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
-#if !FEATURE_THREAD_COUNTDOWNEVENT
-using CountdownEvent = Renci.SshNet.Common.CountdownEvent;
-#else
 using System.Threading;
-#endif
 
 namespace Renci.SshNet.Tests.Classes.Common
 {

+ 0 - 4
src/Renci.SshNet.Tests/Classes/Common/CountdownEventTest_Dispose_Set.cs

@@ -1,10 +1,6 @@
 using System;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
-#if !FEATURE_THREAD_COUNTDOWNEVENT
-using CountdownEvent = Renci.SshNet.Common.CountdownEvent;
-#else
 using System.Threading;
-#endif
 
 namespace Renci.SshNet.Tests.Classes.Common
 {

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamAsyncTestBase.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.Threading.Tasks;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Moq;
@@ -66,4 +65,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileAccessInvalid.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading.Tasks;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -54,4 +53,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessRead.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading.Tasks;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -55,4 +54,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessReadWrite.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading.Tasks;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -55,4 +54,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessWrite.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading;
 using System.Threading.Tasks;
@@ -152,4 +151,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreateNew_FileAccessRead.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading.Tasks;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -55,4 +54,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreateNew_FileAccessReadWrite.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading;
 using System.Threading.Tasks;
@@ -133,4 +132,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreateNew_FileAccessWrite.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading;
 using System.Threading.Tasks;
@@ -133,4 +132,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessRead.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading.Tasks;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -55,4 +54,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileDoesNotExist.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading;
 using System.Threading.Tasks;
@@ -133,4 +132,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileExists.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading;
 using System.Threading.Tasks;
@@ -133,4 +132,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 2 - 4
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessWrite_FileDoesNotExist.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading;
 using System.Threading.Tasks;
@@ -132,5 +131,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp
             SftpSessionMock.Verify(p => p.RequestOpenAsync(_path, Flags.Write | Flags.CreateNewOrOpen | Flags.Truncate, _cancellationToken), Times.Once);
         }
     }
-}
-#endif
+}

+ 2 - 4
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessWrite_FileExists.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading;
 using System.Threading.Tasks;
@@ -132,5 +131,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp
             SftpSessionMock.Verify(p => p.RequestOpenAsync(_path, Flags.Write | Flags.CreateNewOrOpen | Flags.Truncate, _cancellationToken), Times.Once);
         }
     }
-}
-#endif
+}

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeInvalid.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading.Tasks;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -54,4 +53,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 2 - 4
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessRead.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading;
 using System.Threading.Tasks;
@@ -137,5 +136,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp
             SftpSessionMock.Verify(p => p.RequestOpenAsync(_path, Flags.Read | Flags.CreateNewOrOpen, _cancellationToken), Times.Once);
         }
     }
-}
-#endif
+}

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessReadWrite.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading;
 using System.Threading.Tasks;
@@ -133,4 +132,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessWrite.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading;
 using System.Threading.Tasks;
@@ -133,4 +132,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessRead.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading;
 using System.Threading.Tasks;
@@ -139,4 +138,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessReadWrite.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading;
 using System.Threading.Tasks;
@@ -133,4 +132,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessWrite.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading;
 using System.Threading.Tasks;
@@ -133,4 +132,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessRead.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading;
 using System.Threading.Tasks;
@@ -56,4 +55,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessReadWrite.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading;
 using System.Threading.Tasks;
@@ -133,4 +132,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 2 - 4
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessWrite.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading;
 using System.Threading.Tasks;
@@ -132,5 +131,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp
             SftpSessionMock.Verify(p => p.RequestOpenAsync(_path, Flags.Write | Flags.Truncate, _cancellationToken), Times.Once);
         }
     }
-}
-#endif
+}

+ 2 - 4
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndEqualToBufferSize.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading.Tasks;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -155,5 +154,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp
             SftpSessionMock.Verify(p => p.RequestReadAsync(_handle, (ulong)(_serverData1Length + _serverData2Length), _readBufferSize, default));
         }
     }
-}
-#endif
+}

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndLessThanBufferSize.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using System.Threading.Tasks;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -149,4 +148,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadMoreBytesFromServerThanCount.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.IO;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Moq;
@@ -140,4 +139,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_WriteAsync_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.Globalization;
 using System.IO;
 using System.Threading;
@@ -140,4 +139,3 @@ namespace Renci.SshNet.Tests.Classes.Sftp
         }
     }
 }
-#endif

+ 2 - 4
src/Renci.SshNet.Tests/Classes/SftpClientTest.ConnectAsync.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.Net.Sockets;
 using System.Threading.Tasks;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -44,5 +43,4 @@ namespace Renci.SshNet.Tests.Classes
             }
         }
     }
-}
-#endif
+}

+ 2 - 4
src/Renci.SshNet.Tests/Classes/SftpClientTest.DeleteFileAsync.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Renci.SshNet.Tests.Properties;
 using System;
 using System.Threading.Tasks;
@@ -23,5 +22,4 @@ namespace Renci.SshNet.Tests.Classes
             }
         }
     }
-}
-#endif
+}

+ 1 - 3
src/Renci.SshNet.Tests/Classes/SftpClientTest.RenameFileAsync.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Renci.SshNet.Tests.Properties;
 using System;
 using System.IO;
@@ -63,4 +62,3 @@ namespace Renci.SshNet.Tests.Classes
         }
     }
 }
-#endif

+ 0 - 3
src/Renci.SshNet.Tests/Common/AsyncSocketListener.cs

@@ -3,9 +3,6 @@ using System.Collections.Generic;
 using System.Net;
 using System.Net.Sockets;
 using System.Threading;
-#if !FEATURE_SOCKET_DISPOSE
-using Renci.SshNet.Common;
-#endif // !FEATURE_SOCKET_DISPOSE
 
 namespace Renci.SshNet.Tests.Common
 {

+ 1 - 1
src/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj

@@ -7,7 +7,7 @@
   </PropertyGroup>
 
   <PropertyGroup>
-    <DefineConstants>FEATURE_THREAD_COUNTDOWNEVENT;FEATURE_TPL;FEATURE_TAP</DefineConstants>
+    <DefineConstants>FEATURE_TPL</DefineConstants>
   </PropertyGroup>
 
   <ItemGroup>

+ 0 - 129
src/Renci.SshNet/Abstractions/CryptoAbstraction.cs

@@ -5,9 +5,7 @@ namespace Renci.SshNet.Abstractions
 {
     internal static class CryptoAbstraction
     {
-#if FEATURE_RNG_CREATE || FEATURE_RNG_CSP
         private static readonly System.Security.Cryptography.RandomNumberGenerator Randomizer = CreateRandomNumberGenerator();
-#endif
 
         /// <summary>
         /// Generates a <see cref="Byte"/> array of the specified length, and fills it with a
@@ -31,105 +29,38 @@ namespace Renci.SshNet.Abstractions
         /// </remarks>
         public static void GenerateRandom(byte[] data)
         {
-#if FEATURE_RNG_CREATE || FEATURE_RNG_CSP
             Randomizer.GetBytes(data);
-#else
-            if(data == null)
-                throw new ArgumentNullException("data");
-
-            var buffer = Windows.Security.Cryptography.CryptographicBuffer.GenerateRandom((uint) data.Length);
-            System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeBufferExtensions.CopyTo(buffer, data);
-#endif
         }
 
-#if FEATURE_RNG_CREATE || FEATURE_RNG_CSP
         public static System.Security.Cryptography.RandomNumberGenerator CreateRandomNumberGenerator()
         {
-#if FEATURE_RNG_CREATE
             return System.Security.Cryptography.RandomNumberGenerator.Create();
-#elif FEATURE_RNG_CSP
-            return new System.Security.Cryptography.RNGCryptoServiceProvider();
-#else
-#error Creation of RandomNumberGenerator is not implemented.
-#endif
         }
-#endif // FEATURE_RNG_CREATE || FEATURE_RNG_CSP
 
-#if FEATURE_HASH_MD5
         public static System.Security.Cryptography.MD5 CreateMD5()
         {
             return System.Security.Cryptography.MD5.Create();
         }
-#else
-        public static global::SshNet.Security.Cryptography.MD5 CreateMD5()
-        {
-            return new global::SshNet.Security.Cryptography.MD5();
-        }
-#endif // FEATURE_HASH_MD5
 
-#if FEATURE_HASH_SHA1_CREATE || FEATURE_HASH_SHA1_MANAGED
         public static System.Security.Cryptography.SHA1 CreateSHA1()
         {
-#if FEATURE_HASH_SHA1_CREATE
             return System.Security.Cryptography.SHA1.Create();
-#elif FEATURE_HASH_SHA1_MANAGED
-            return new System.Security.Cryptography.SHA1Managed();
-#endif
         }
-#else
-        public static global::SshNet.Security.Cryptography.SHA1 CreateSHA1()
-        {
-            return new global::SshNet.Security.Cryptography.SHA1();
-        }
-#endif
 
-#if FEATURE_HASH_SHA256_CREATE || FEATURE_HASH_SHA256_MANAGED
         public static System.Security.Cryptography.SHA256 CreateSHA256()
         {
-#if FEATURE_HASH_SHA256_CREATE
             return System.Security.Cryptography.SHA256.Create();
-#elif FEATURE_HASH_SHA256_MANAGED
-            return new System.Security.Cryptography.SHA256Managed();
-#endif
         }
-#else
-        public static global::SshNet.Security.Cryptography.SHA256 CreateSHA256()
-        {
-            return new global::SshNet.Security.Cryptography.SHA256();
-        }
-#endif
 
-#if FEATURE_HASH_SHA384_CREATE || FEATURE_HASH_SHA384_MANAGED
         public static System.Security.Cryptography.SHA384 CreateSHA384()
         {
-#if FEATURE_HASH_SHA384_CREATE
             return System.Security.Cryptography.SHA384.Create();
-#elif FEATURE_HASH_SHA384_MANAGED
-            return new System.Security.Cryptography.SHA384Managed();
-#endif
-        }
-#else
-        public static global::SshNet.Security.Cryptography.SHA384 CreateSHA384()
-        {
-            return new global::SshNet.Security.Cryptography.SHA384();
         }
-#endif
 
-#if FEATURE_HASH_SHA512_CREATE || FEATURE_HASH_SHA512_MANAGED
         public static System.Security.Cryptography.SHA512 CreateSHA512()
         {
-#if FEATURE_HASH_SHA512_CREATE
             return System.Security.Cryptography.SHA512.Create();
-#elif FEATURE_HASH_SHA512_MANAGED
-            return new System.Security.Cryptography.SHA512Managed();
-#endif
         }
-#else
-        public static global::SshNet.Security.Cryptography.SHA512 CreateSHA512()
-        {
-            return new global::SshNet.Security.Cryptography.SHA512();
-        }
-#endif
 
 #if FEATURE_HASH_RIPEMD160_CREATE || FEATURE_HASH_RIPEMD160_MANAGED
         public static System.Security.Cryptography.RIPEMD160 CreateRIPEMD160()
@@ -147,7 +78,6 @@ namespace Renci.SshNet.Abstractions
         }
 #endif // FEATURE_HASH_RIPEMD160
 
-#if FEATURE_HMAC_MD5
         public static System.Security.Cryptography.HMACMD5 CreateHMACMD5(byte[] key)
         {
             return new System.Security.Cryptography.HMACMD5(key);
@@ -157,19 +87,7 @@ namespace Renci.SshNet.Abstractions
         {
             return new HMACMD5(key, hashSize);
         }
-#else
-        public static global::SshNet.Security.Cryptography.HMACMD5 CreateHMACMD5(byte[] key)
-        {
-            return new global::SshNet.Security.Cryptography.HMACMD5(key);
-        }
-
-        public static global::SshNet.Security.Cryptography.HMACMD5 CreateHMACMD5(byte[] key, int hashSize)
-        {
-            return new global::SshNet.Security.Cryptography.HMACMD5(key, hashSize);
-        }
-#endif // FEATURE_HMAC_MD5
 
-#if FEATURE_HMAC_SHA1
         public static System.Security.Cryptography.HMACSHA1 CreateHMACSHA1(byte[] key)
         {
             return new System.Security.Cryptography.HMACSHA1(key);
@@ -179,19 +97,7 @@ namespace Renci.SshNet.Abstractions
         {
             return new HMACSHA1(key, hashSize);
         }
-#else
-        public static global::SshNet.Security.Cryptography.HMACSHA1 CreateHMACSHA1(byte[] key)
-        {
-            return new global::SshNet.Security.Cryptography.HMACSHA1(key);
-        }
 
-        public static global::SshNet.Security.Cryptography.HMACSHA1 CreateHMACSHA1(byte[] key, int hashSize)
-        {
-            return new global::SshNet.Security.Cryptography.HMACSHA1(key, hashSize);
-        }
-#endif // FEATURE_HMAC_SHA1
-
-#if FEATURE_HMAC_SHA256
         public static System.Security.Cryptography.HMACSHA256 CreateHMACSHA256(byte[] key)
         {
             return new System.Security.Cryptography.HMACSHA256(key);
@@ -201,19 +107,7 @@ namespace Renci.SshNet.Abstractions
         {
             return new HMACSHA256(key, hashSize);
         }
-#else
-        public static global::SshNet.Security.Cryptography.HMACSHA256 CreateHMACSHA256(byte[] key)
-        {
-            return new global::SshNet.Security.Cryptography.HMACSHA256(key);
-        }
 
-        public static global::SshNet.Security.Cryptography.HMACSHA256 CreateHMACSHA256(byte[] key, int hashSize)
-        {
-            return new global::SshNet.Security.Cryptography.HMACSHA256(key, hashSize);
-        }
-#endif // FEATURE_HMAC_SHA256
-
-#if FEATURE_HMAC_SHA384
         public static System.Security.Cryptography.HMACSHA384 CreateHMACSHA384(byte[] key)
         {
             return new System.Security.Cryptography.HMACSHA384(key);
@@ -223,19 +117,7 @@ namespace Renci.SshNet.Abstractions
         {
             return new HMACSHA384(key, hashSize);
         }
-#else
-        public static global::SshNet.Security.Cryptography.HMACSHA384 CreateHMACSHA384(byte[] key)
-        {
-            return new global::SshNet.Security.Cryptography.HMACSHA384(key);
-        }
-
-        public static global::SshNet.Security.Cryptography.HMACSHA384 CreateHMACSHA384(byte[] key, int hashSize)
-        {
-            return new global::SshNet.Security.Cryptography.HMACSHA384(key, hashSize);
-        }
-#endif // FEATURE_HMAC_SHA384
 
-#if FEATURE_HMAC_SHA512
         public static System.Security.Cryptography.HMACSHA512 CreateHMACSHA512(byte[] key)
         {
             return new System.Security.Cryptography.HMACSHA512(key);
@@ -245,17 +127,6 @@ namespace Renci.SshNet.Abstractions
         {
             return new HMACSHA512(key, hashSize);
         }
-#else
-        public static global::SshNet.Security.Cryptography.HMACSHA512 CreateHMACSHA512(byte[] key)
-        {
-            return new global::SshNet.Security.Cryptography.HMACSHA512(key);
-        }
-
-        public static global::SshNet.Security.Cryptography.HMACSHA512 CreateHMACSHA512(byte[] key, int hashSize)
-        {
-            return new global::SshNet.Security.Cryptography.HMACSHA512(key, hashSize);
-        }
-#endif // FEATURE_HMAC_SHA512
 
 #if FEATURE_HMAC_RIPEMD160
         public static System.Security.Cryptography.HMACRIPEMD160 CreateHMACRIPEMD160(byte[] key)

+ 0 - 7
src/Renci.SshNet/Abstractions/DiagnosticAbstraction.cs

@@ -1,14 +1,10 @@
 using System.Diagnostics;
-#if FEATURE_DIAGNOSTICS_TRACESOURCE
 using System.Threading;
-#endif // FEATURE_DIAGNOSTICS_TRACESOURCE
 
 namespace Renci.SshNet.Abstractions
 {
     internal static class DiagnosticAbstraction
     {
-#if FEATURE_DIAGNOSTICS_TRACESOURCE
-
         private static readonly SourceSwitch SourceSwitch = new SourceSwitch("SshNetSwitch");
 
         public static bool IsEnabled(TraceEventType traceEventType)
@@ -22,14 +18,11 @@ namespace Renci.SshNet.Abstractions
 #else
             new TraceSource("SshNet.Logging");
 #endif // DEBUG
-#endif // FEATURE_DIAGNOSTICS_TRACESOURCE
 
         [Conditional("DEBUG")]
         public static void Log(string text)
         {
-#if FEATURE_DIAGNOSTICS_TRACESOURCE
             Loggging.TraceEvent(TraceEventType.Verbose, Thread.CurrentThread.ManagedThreadId, text);
-#endif // FEATURE_DIAGNOSTICS_TRACESOURCE
         }
     }
 }

+ 0 - 6
src/Renci.SshNet/Abstractions/DnsAbstraction.cs

@@ -1,10 +1,7 @@
 using System;
 using System.Net;
 using System.Net.Sockets;
-
-#if FEATURE_TAP
 using System.Threading.Tasks;
-#endif
 
 #if FEATURE_DNS_SYNC
 #elif FEATURE_DNS_APM
@@ -92,7 +89,6 @@ namespace Renci.SshNet.Abstractions
 #endif
         }
 
-#if FEATURE_TAP
         /// <summary>
         /// Returns the Internet Protocol (IP) addresses for the specified host.
         /// </summary>
@@ -107,7 +103,5 @@ namespace Renci.SshNet.Abstractions
         {
             return Dns.GetHostAddressesAsync(hostNameOrAddress);
         }
-#endif
-
     }
 }

+ 0 - 8
src/Renci.SshNet/Abstractions/ReflectionAbstraction.cs

@@ -1,10 +1,6 @@
 using System;
 using System.Collections.Generic;
-#if FEATURE_REFLECTION_TYPEINFO
-using System.Reflection;
-#else
 using System.Linq;
-#endif // FEATURE_REFLECTION_TYPEINFO
 
 namespace Renci.SshNet.Abstractions
 {
@@ -13,12 +9,8 @@ namespace Renci.SshNet.Abstractions
         public static IEnumerable<T> GetCustomAttributes<T>(this Type type, bool inherit)
             where T:Attribute
         {
-#if FEATURE_REFLECTION_TYPEINFO
-            return type.GetTypeInfo().GetCustomAttributes<T>(inherit);
-#else
             var attributes = type.GetCustomAttributes(typeof(T), inherit);
             return attributes.Cast<T>();
-#endif
         }
     }
 }

+ 2 - 359
src/Renci.SshNet/Abstractions/SocketAbstraction.cs

@@ -3,9 +3,8 @@ using System.Globalization;
 using System.Net;
 using System.Net.Sockets;
 using System.Threading;
-#if FEATURE_TAP
 using System.Threading.Tasks;
-#endif
+
 using Renci.SshNet.Common;
 using Renci.SshNet.Messages.Transport;
 
@@ -17,11 +16,7 @@ namespace Renci.SshNet.Abstractions
         {
             if (socket.Connected)
             {
-#if FEATURE_SOCKET_POLL
                 return socket.Poll(-1, SelectMode.SelectRead) && socket.Available > 0;
-#else
-                return true;
-#endif // FEATURE_SOCKET_POLL
             }
 
             return false;
@@ -40,11 +35,7 @@ namespace Renci.SshNet.Abstractions
         {
             if (socket != null && socket.Connected)
             {
-#if FEATURE_SOCKET_POLL
                 return socket.Poll(-1, SelectMode.SelectWrite);
-#else
-                return true;
-#endif // FEATURE_SOCKET_POLL
             }
 
             return false;
@@ -62,12 +53,10 @@ namespace Renci.SshNet.Abstractions
             ConnectCore(socket, remoteEndpoint, connectTimeout, false);
         }
 
-#if FEATURE_TAP
         public static async Task ConnectAsync(Socket socket, IPEndPoint remoteEndpoint, CancellationToken cancellationToken)
         {
             await socket.ConnectAsync(remoteEndpoint, cancellationToken).ConfigureAwait(false);
         }
-#endif
 
         private static void ConnectCore(Socket socket, IPEndPoint remoteEndpoint, TimeSpan connectTimeout, bool ownsSocket)
         {
@@ -153,7 +142,6 @@ namespace Renci.SshNet.Abstractions
 
         public static int ReadPartial(Socket socket, byte[] buffer, int offset, int size, TimeSpan timeout)
         {
-#if FEATURE_SOCKET_SYNC
             socket.ReceiveTimeout = (int) timeout.TotalMilliseconds;
 
             try
@@ -167,53 +155,10 @@ namespace Renci.SshNet.Abstractions
                         "Socket read operation has timed out after {0:F0} milliseconds.", timeout.TotalMilliseconds));
                 throw;
             }
-#elif FEATURE_SOCKET_EAP
-            var receiveCompleted = new ManualResetEvent(false);
-            var sendReceiveToken = new PartialSendReceiveToken(socket, receiveCompleted);
-            var args = new SocketAsyncEventArgs
-                {
-                    RemoteEndPoint = socket.RemoteEndPoint,
-                    UserToken = sendReceiveToken
-                };
-            args.Completed += ReceiveCompleted;
-            args.SetBuffer(buffer, offset, size);
-
-            try
-            {
-                if (socket.ReceiveAsync(args))
-                {
-                    if (!receiveCompleted.WaitOne(timeout))
-                        throw new SshOperationTimeoutException(
-                            string.Format(
-                                CultureInfo.InvariantCulture,
-                                "Socket read operation has timed out after {0:F0} milliseconds.",
-                                timeout.TotalMilliseconds));
-                }
-                else
-                {
-                    sendReceiveToken.Process(args);
-                }
-
-                if (args.SocketError != SocketError.Success)
-                    throw new SocketException((int) args.SocketError);
-
-                return args.BytesTransferred;
-            }
-            finally
-            {
-                // initialize token to avoid the waithandle getting used after it's disposed
-                args.UserToken = null;
-                args.Dispose();
-                receiveCompleted.Dispose();
-            }
-#else
-            #error Receiving data from a Socket is not implemented.
-#endif
         }
 
         public static void ReadContinuous(Socket socket, byte[] buffer, int offset, int size, Action<byte[], int, int> processReceivedBytesAction)
         {
-#if FEATURE_SOCKET_SYNC
             // do not time-out receive
             socket.ReceiveTimeout = 0;
 
@@ -247,30 +192,6 @@ namespace Renci.SshNet.Abstractions
                     }
                 }
             }
-#elif FEATURE_SOCKET_EAP
-            var completionWaitHandle = new ManualResetEvent(false);
-            var readToken = new ContinuousReceiveToken(socket, processReceivedBytesAction, completionWaitHandle);
-            var args = new SocketAsyncEventArgs
-            {
-                RemoteEndPoint = socket.RemoteEndPoint,
-                UserToken = readToken
-            };
-            args.Completed += ReceiveCompleted;
-            args.SetBuffer(buffer, offset, size);
-
-            if (!socket.ReceiveAsync(args))
-            {
-                ReceiveCompleted(null, args);
-            }
-
-            completionWaitHandle.WaitOne();
-            completionWaitHandle.Dispose();
-
-            if (readToken.Exception != null)
-                throw readToken.Exception;
-#else
-            #error Receiving data from a Socket is not implemented.
-#endif
         }
 
         /// <summary>
@@ -327,12 +248,10 @@ namespace Renci.SshNet.Abstractions
             return buffer;
         }
 
-#if FEATURE_TAP
         public static Task<int> ReadAsync(Socket socket, byte[] buffer, int offset, int length, CancellationToken cancellationToken)
         {
             return socket.ReceiveAsync(buffer, offset, length, cancellationToken);
         }
-#endif
 
         /// <summary>
         /// Receives data from a bound <see cref="Socket"/> into a receive buffer.
@@ -358,7 +277,6 @@ namespace Renci.SshNet.Abstractions
         /// </remarks>
         public static int Read(Socket socket, byte[] buffer, int offset, int size, TimeSpan readTimeout)
         {
-#if FEATURE_SOCKET_SYNC
             var totalBytesRead = 0;
             var totalBytesToRead = size;
 
@@ -386,52 +304,12 @@ namespace Renci.SshNet.Abstractions
                         throw new SshOperationTimeoutException(string.Format(CultureInfo.InvariantCulture,
                             "Socket read operation has timed out after {0:F0} milliseconds.", readTimeout.TotalMilliseconds));
 
-                     throw;
+                    throw;
                 }
             }
             while (totalBytesRead < totalBytesToRead);
 
             return totalBytesRead;
-#elif FEATURE_SOCKET_EAP
-            var receiveCompleted = new ManualResetEvent(false);
-            var sendReceiveToken = new BlockingSendReceiveToken(socket, buffer, offset, size, receiveCompleted);
-
-            var args = new SocketAsyncEventArgs
-                {
-                    UserToken = sendReceiveToken,
-                    RemoteEndPoint = socket.RemoteEndPoint
-                };
-            args.Completed += ReceiveCompleted;
-            args.SetBuffer(buffer, offset, size);
-
-            try
-            {
-                if (socket.ReceiveAsync(args))
-                {
-                    if (!receiveCompleted.WaitOne(readTimeout))
-                        throw new SshOperationTimeoutException(string.Format(CultureInfo.InvariantCulture,
-                            "Socket read operation has timed out after {0:F0} milliseconds.", readTimeout.TotalMilliseconds));
-                }
-                else
-                {
-                    sendReceiveToken.Process(args);
-                }
-
-                if (args.SocketError != SocketError.Success)
-                        throw new SocketException((int) args.SocketError);
-
-                return sendReceiveToken.TotalBytesTransferred;
-            }
-            finally
-            {
-                // initialize token to avoid the waithandle getting used after it's disposed
-                args.UserToken = null;
-                args.Dispose();
-                receiveCompleted.Dispose();
-            }
-#else
-#error Receiving data from a Socket is not implemented.
-#endif
         }
 
         public static void Send(Socket socket, byte[] data)
@@ -441,7 +319,6 @@ namespace Renci.SshNet.Abstractions
 
         public static void Send(Socket socket, byte[] data, int offset, int size)
         {
-#if FEATURE_SOCKET_SYNC
             var totalBytesSent = 0;  // how many bytes are already sent
             var totalBytesToSend = size;
 
@@ -467,46 +344,6 @@ namespace Renci.SshNet.Abstractions
                         throw;  // any serious error occurr
                 }
             } while (totalBytesSent < totalBytesToSend);
-#elif FEATURE_SOCKET_EAP
-            var sendCompleted = new ManualResetEvent(false);
-            var sendReceiveToken = new BlockingSendReceiveToken(socket, data, offset, size, sendCompleted);
-            var socketAsyncSendArgs = new SocketAsyncEventArgs
-                {
-                    RemoteEndPoint = socket.RemoteEndPoint,
-                    UserToken = sendReceiveToken
-                };
-            socketAsyncSendArgs.SetBuffer(data, offset, size);
-            socketAsyncSendArgs.Completed += SendCompleted;
-
-            try
-            {
-                if (socket.SendAsync(socketAsyncSendArgs))
-                {
-                    if (!sendCompleted.WaitOne())
-                        throw new SocketException((int) SocketError.TimedOut);
-                }
-                else
-                {
-                    sendReceiveToken.Process(socketAsyncSendArgs);
-                }
-
-                if (socketAsyncSendArgs.SocketError != SocketError.Success)
-                    throw new SocketException((int) socketAsyncSendArgs.SocketError);
-
-                if (sendReceiveToken.TotalBytesTransferred == 0)
-                    throw new SshConnectionException("An established connection was aborted by the server.",
-                                                     DisconnectReason.ConnectionLost);
-            }
-            finally
-            {
-                // initialize token to avoid the completion waithandle getting used after it's disposed
-                socketAsyncSendArgs.UserToken = null;
-                socketAsyncSendArgs.Dispose();
-                sendCompleted.Dispose();
-            }
-#else
-            #error Sending data to a Socket is not implemented.
-#endif
         }
 
         public static bool IsErrorResumable(SocketError socketError)
@@ -531,199 +368,5 @@ namespace Renci.SshNet.Abstractions
         }
 #endif // FEATURE_SOCKET_EAP
 
-#if FEATURE_SOCKET_EAP && !FEATURE_SOCKET_SYNC
-        private static void ReceiveCompleted(object sender, SocketAsyncEventArgs e)
-        {
-            var sendReceiveToken = (Token) e.UserToken;
-            if (sendReceiveToken != null)
-                sendReceiveToken.Process(e);
-        }
-
-        private static void SendCompleted(object sender, SocketAsyncEventArgs e)
-        {
-            var sendReceiveToken = (Token) e.UserToken;
-            if (sendReceiveToken != null)
-                sendReceiveToken.Process(e);
-        }
-
-        private interface Token
-        {
-            void Process(SocketAsyncEventArgs args);
-        }
-
-        private class BlockingSendReceiveToken : Token
-        {
-            public BlockingSendReceiveToken(Socket socket, byte[] buffer, int offset, int size, EventWaitHandle completionWaitHandle)
-            {
-                _socket = socket;
-                _buffer = buffer;
-                _offset = offset;
-                _bytesToTransfer = size;
-                _completionWaitHandle = completionWaitHandle;
-            }
-
-            public void Process(SocketAsyncEventArgs args)
-            {
-                if (args.SocketError == SocketError.Success)
-                {
-                    TotalBytesTransferred += args.BytesTransferred;
-
-                    if (TotalBytesTransferred == _bytesToTransfer)
-                    {
-                        // finished transferring specified bytes
-                        _completionWaitHandle.Set();
-                        return;
-                    }
-
-                    if (args.BytesTransferred == 0)
-                    {
-                        // remote server closed the connection
-                        _completionWaitHandle.Set();
-                        return;
-                    }
-
-                    _offset += args.BytesTransferred;
-                    args.SetBuffer(_buffer, _offset, _bytesToTransfer - TotalBytesTransferred);
-                    ResumeOperation(args);
-                    return;
-                }
-
-                if (IsErrorResumable(args.SocketError))
-                {
-                    ThreadAbstraction.Sleep(30);
-                    ResumeOperation(args);
-                    return;
-                }
-
-                // we're dealing with a (fatal) error
-                _completionWaitHandle.Set();
-            }
-
-            private void ResumeOperation(SocketAsyncEventArgs args)
-            {
-                switch (args.LastOperation)
-                {
-                    case SocketAsyncOperation.Receive:
-                        _socket.ReceiveAsync(args);
-                        break;
-                    case SocketAsyncOperation.Send:
-                        _socket.SendAsync(args);
-                        break;
-                }
-            }
-
-            private readonly int _bytesToTransfer;
-            public int TotalBytesTransferred { get; private set; }
-            private readonly EventWaitHandle _completionWaitHandle;
-            private readonly Socket _socket;
-            private readonly byte[] _buffer;
-            private int _offset;
-        }
-
-        private class PartialSendReceiveToken : Token
-        {
-            public PartialSendReceiveToken(Socket socket, EventWaitHandle completionWaitHandle)
-            {
-                _socket = socket;
-                _completionWaitHandle = completionWaitHandle;
-            }
-
-            public void Process(SocketAsyncEventArgs args)
-            {
-                if (args.SocketError == SocketError.Success)
-                {
-                    _completionWaitHandle.Set();
-                    return;
-                }
-
-                if (IsErrorResumable(args.SocketError))
-                {
-                    ThreadAbstraction.Sleep(30);
-                    ResumeOperation(args);
-                    return;
-                }
-
-                // we're dealing with a (fatal) error
-                _completionWaitHandle.Set();
-            }
-
-            private void ResumeOperation(SocketAsyncEventArgs args)
-            {
-                switch (args.LastOperation)
-                {
-                    case SocketAsyncOperation.Receive:
-                        _socket.ReceiveAsync(args);
-                        break;
-                    case SocketAsyncOperation.Send:
-                        _socket.SendAsync(args);
-                        break;
-                }
-            }
-
-            private readonly EventWaitHandle _completionWaitHandle;
-            private readonly Socket _socket;
-        }
-
-        private class ContinuousReceiveToken : Token
-        {
-            public ContinuousReceiveToken(Socket socket, Action<byte[], int, int> processReceivedBytesAction, EventWaitHandle completionWaitHandle)
-            {
-                _socket = socket;
-                _processReceivedBytesAction = processReceivedBytesAction;
-                _completionWaitHandle = completionWaitHandle;
-            }
-
-            public Exception Exception { get; private set; }
-
-            public void Process(SocketAsyncEventArgs args)
-            {
-                if (args.SocketError == SocketError.Success)
-                {
-                    if (args.BytesTransferred == 0)
-                    {
-                        // remote socket was closed
-                        _completionWaitHandle.Set();
-                        return;
-                    }
-
-                    _processReceivedBytesAction(args.Buffer, args.Offset, args.BytesTransferred);
-                    ResumeOperation(args);
-                    return;
-                }
-
-                if (IsErrorResumable(args.SocketError))
-                {
-                    ThreadAbstraction.Sleep(30);
-                    ResumeOperation(args);
-                    return;
-                }
-
-                if (args.SocketError != SocketError.OperationAborted)
-                {
-                    Exception = new SocketException((int) args.SocketError);
-                }
-
-                // we're dealing with a (fatal) error
-                _completionWaitHandle.Set();
-            }
-
-            private void ResumeOperation(SocketAsyncEventArgs args)
-            {
-                switch (args.LastOperation)
-                {
-                    case SocketAsyncOperation.Receive:
-                        _socket.ReceiveAsync(args);
-                        break;
-                    case SocketAsyncOperation.Send:
-                        _socket.SendAsync(args);
-                        break;
-                }
-            }
-
-            private readonly EventWaitHandle _completionWaitHandle;
-            private readonly Socket _socket;
-            private readonly Action<byte[], int, int> _processReceivedBytesAction;
-        }
-#endif // FEATURE_SOCKET_EAP && !FEATURE_SOCKET_SYNC
     }
 }

+ 1 - 3
src/Renci.SshNet/Abstractions/SocketExtensions.cs

@@ -1,5 +1,4 @@
-#if FEATURE_TAP
-using System;
+using System;
 using System.Net;
 using System.Net.Sockets;
 using System.Runtime.CompilerServices;
@@ -116,4 +115,3 @@ namespace Renci.SshNet.Abstractions
         }
     }
 }
-#endif

+ 0 - 19
src/Renci.SshNet/Abstractions/ThreadAbstraction.cs

@@ -10,13 +10,7 @@ namespace Renci.SshNet.Abstractions
         /// <param name="millisecondsTimeout">The number of milliseconds for which the thread is suspended.</param>
         public static void Sleep(int millisecondsTimeout)
         {
-#if FEATURE_THREAD_SLEEP
             System.Threading.Thread.Sleep(millisecondsTimeout);
-#elif FEATURE_THREAD_TAP
-            System.Threading.Tasks.Task.Delay(millisecondsTimeout).GetAwaiter().GetResult();
-#else
-            #error Suspend of the current thread is not implemented.
-#endif
         }
 
         public static void ExecuteThreadLongRunning(Action action)
@@ -24,15 +18,8 @@ namespace Renci.SshNet.Abstractions
             if (action == null)
                 throw new ArgumentNullException("action");
 
-#if FEATURE_THREAD_TAP
             var taskCreationOptions = System.Threading.Tasks.TaskCreationOptions.LongRunning;
             System.Threading.Tasks.Task.Factory.StartNew(action, taskCreationOptions);
-#else
-            new System.Threading.Thread(() => action())
-            {
-                IsBackground = true
-            }.Start();
-#endif
         }
 
         /// <summary>
@@ -41,16 +28,10 @@ namespace Renci.SshNet.Abstractions
         /// <param name="action">The action to execute.</param>
         public static void ExecuteThread(Action action)
         {
-#if FEATURE_THREAD_THREADPOOL
             if (action == null)
                 throw new ArgumentNullException("action");
 
             System.Threading.ThreadPool.QueueUserWorkItem(o => action());
-#elif FEATURE_THREAD_TAP
-            System.Threading.Tasks.Task.Run(action);
-#else
-            #error Execution of action in a separate thread is not implemented.
-#endif
         }
     }
 }

+ 1 - 6
src/Renci.SshNet/BaseClient.cs

@@ -1,9 +1,8 @@
 using System;
 using System.Net.Sockets;
 using System.Threading;
-#if FEATURE_TAP
 using System.Threading.Tasks;
-#endif
+
 using Renci.SshNet.Abstractions;
 using Renci.SshNet.Common;
 using Renci.SshNet.Messages.Transport;
@@ -242,7 +241,6 @@ namespace Renci.SshNet
             StartKeepAliveTimer();
         }
 
-#if FEATURE_TAP
         /// <summary>
         /// Asynchronously connects client to the server.
         /// </summary>
@@ -297,7 +295,6 @@ namespace Renci.SshNet
             }
             StartKeepAliveTimer();
         }
-#endif
 
         /// <summary>
         /// Disconnects client from the server.
@@ -533,7 +530,6 @@ namespace Renci.SshNet
             }
         }
 
-#if FEATURE_TAP
         private async Task<ISession> CreateAndConnectSessionAsync(CancellationToken cancellationToken)
         {
             var session = _serviceFactory.CreateSession(ConnectionInfo, _serviceFactory.CreateSocketFactory());
@@ -551,7 +547,6 @@ namespace Renci.SshNet
                 throw;
             }
         }
-#endif
 
         private void DisposeSession(ISession session)
         {

+ 0 - 167
src/Renci.SshNet/Common/ASCIIEncoding.cs

@@ -1,167 +0,0 @@
-#if !FEATURE_ENCODING_ASCII
-
-using System;
-using System.Text;
-
-namespace Renci.SshNet.Common
-{
-    /// <summary>
-    /// Implementation of ASCII Encoding
-    /// </summary>
-    public class ASCIIEncoding : Encoding
-    {
-        private readonly char _fallbackChar;
-
-        private static readonly char[] ByteToChar;
-
-        static ASCIIEncoding()
-        {
-            if (ByteToChar == null)
-            {
-                ByteToChar = new char[128];
-                var ch = '\0';
-                for (byte i = 0; i < 128; i++)
-                {
-                    ByteToChar[i] = ch++;
-                }
-            }
-        }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="ASCIIEncoding"/> class.
-        /// </summary>
-        public ASCIIEncoding()
-        {
-            _fallbackChar = '?';
-        }
-
-        /// <summary>
-        /// Calculates the number of bytes produced by encoding a set of characters from the specified character array.
-        /// </summary>
-        /// <param name="chars">The character array containing the set of characters to encode.</param>
-        /// <param name="index">The index of the first character to encode.</param>
-        /// <param name="count">The number of characters to encode.</param>
-        /// <returns>
-        /// The number of bytes produced by encoding the specified characters.
-        /// </returns>
-        /// <exception cref="ArgumentNullException"><paramref name="chars"/> is  <c>null</c>.</exception>
-        /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> or <paramref name="count"/> is less than zero.-or- <paramref name="index"/> and <paramref name="count"/> do not denote a valid range in <paramref name="chars"/>.</exception>
-        public override int GetByteCount(char[] chars, int index, int count)
-        {
-            return count;
-        }
-
-        /// <summary>
-        /// Encodes a set of characters from the specified character array into the specified byte array.
-        /// </summary>
-        /// <param name="chars">The character array containing the set of characters to encode.</param>
-        /// <param name="charIndex">The index of the first character to encode.</param>
-        /// <param name="charCount">The number of characters to encode.</param>
-        /// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
-        /// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
-        /// <returns>
-        /// The actual number of bytes written into <paramref name="bytes"/>.
-        /// </returns>
-        /// <exception cref="ArgumentNullException"><paramref name="chars"/> is  <c>null</c>.-or- <paramref name="bytes"/> is  <c>null</c>.</exception>
-        /// <exception cref="ArgumentOutOfRangeException"><paramref name="charIndex"/> or <paramref name="charCount"/> or <paramref name="byteIndex"/> is less than zero.-or- <paramref name="charIndex"/> and <paramref name="charCount"/> do not denote a valid range in <paramref name="chars"/>.-or- <paramref name="byteIndex"/> is not a valid index in <paramref name="bytes"/>.</exception>
-        /// <exception cref="ArgumentException"><paramref name="bytes"/> does not have enough capacity from <paramref name="byteIndex"/> to the end of the array to accommodate the resulting bytes.</exception>
-        public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
-        {
-            for (var i = 0; i < charCount && i < chars.Length; i++)
-            {
-                var b = (byte)chars[i + charIndex];
-
-                if (b > 127)
-                    b = (byte) _fallbackChar;
-
-                bytes[i + byteIndex] = b;
-            }
-            return charCount;
-        }
-
-        /// <summary>
-        /// Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
-        /// </summary>
-        /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
-        /// <param name="index">The index of the first byte to decode.</param>
-        /// <param name="count">The number of bytes to decode.</param>
-        /// <returns>
-        /// The number of characters produced by decoding the specified sequence of bytes.
-        /// </returns>
-        /// <exception cref="ArgumentNullException"><paramref name="bytes"/> is <c>null</c>.</exception>
-        /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> or <paramref name="count"/> is less than zero.-or- <paramref name="index"/> and <paramref name="count"/> do not denote a valid range in <paramref name="bytes"/>.</exception>
-        public override int GetCharCount(byte[] bytes, int index, int count)
-        {
-            return count;
-        }
-
-        /// <summary>
-        /// Decodes a sequence of bytes from the specified byte array into the specified character array.
-        /// </summary>
-        /// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
-        /// <param name="byteIndex">The index of the first byte to decode.</param>
-        /// <param name="byteCount">The number of bytes to decode.</param>
-        /// <param name="chars">The character array to contain the resulting set of characters.</param>
-        /// <param name="charIndex">The index at which to start writing the resulting set of characters.</param>
-        /// <returns>
-        /// The actual number of characters written into <paramref name="chars"/>.
-        /// </returns>
-        /// <exception cref="ArgumentNullException"><paramref name="bytes"/> is  <c>null</c>.-or- <paramref name="chars"/> is  <c>null</c>.</exception>
-        /// <exception cref="ArgumentOutOfRangeException"><paramref name="byteIndex"/> or <paramref name="byteCount"/> or <paramref name="charIndex"/> is less than zero.-or- <paramref name="byteIndex"/> and <paramref name="byteCount"/> do not denote a valid range in <paramref name="bytes"/>.-or- <paramref name="charIndex"/> is not a valid index in <paramref name="chars"/>.</exception>
-        /// <exception cref="ArgumentException"><paramref name="chars"/> does not have enough capacity from <paramref name="charIndex"/> to the end of the array to accommodate the resulting characters.</exception>
-        public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
-        {
-            for (var i = 0; i < byteCount; i++)
-            {
-                var b = bytes[i + byteIndex];
-                char ch;
-
-                if (b > 127)
-                {
-                    ch = _fallbackChar;
-                }
-                else 
-                {
-                    ch = ByteToChar[b];
-                }
-
-                chars[i + charIndex] = ch;
-            }
-            return byteCount;
-        }
-
-        /// <summary>
-        /// Calculates the maximum number of bytes produced by encoding the specified number of characters.
-        /// </summary>
-        /// <param name="charCount">The number of characters to encode.</param>
-        /// <returns>
-        /// The maximum number of bytes produced by encoding the specified number of characters.
-        /// </returns>
-        /// <exception cref="ArgumentOutOfRangeException"><paramref name="charCount"/> is less than zero.</exception>
-        public override int GetMaxByteCount(int charCount)
-        {
-            if (charCount < 0)
-                throw new ArgumentOutOfRangeException("charCount", "Non-negative number required.");
-
-            return charCount + 1;
-        }
-
-        /// <summary>
-        /// Calculates the maximum number of characters produced by decoding the specified number of bytes.
-        /// </summary>
-        /// <param name="byteCount">The number of bytes to decode.</param>
-        /// <returns>
-        /// The maximum number of characters produced by decoding the specified number of bytes.
-        /// </returns>
-        /// <exception cref="ArgumentOutOfRangeException"><paramref name="byteCount"/> is less than zero.</exception>
-        public override int GetMaxCharCount(int byteCount)
-        {
-            if (byteCount < 0)
-                throw new ArgumentOutOfRangeException("byteCount", "Non-negative number required.");
-
-            return byteCount;
-        }
-    }
-}
-
-#endif // !FEATURE_ENCODING_ASCII

+ 0 - 171
src/Renci.SshNet/Common/CountdownEvent.cs

@@ -1,171 +0,0 @@
-#if !FEATURE_THREAD_COUNTDOWNEVENT
-
-using System;
-using System.Threading;
-
-namespace Renci.SshNet.Common
-{
-    /// <summary>
-    /// Represents a synchronization primitive that is signaled when its count reaches zero.
-    /// </summary>
-    internal class CountdownEvent : IDisposable
-    {
-        private int _count;
-        private ManualResetEvent _event;
-        private bool _disposed;
-
-        /// <summary>
-        /// Initializes a new instance of <see cref="CountdownEvent"/> class with the specified count.
-        /// </summary>
-        /// <param name="initialCount">The number of signals initially required to set the <see cref="CountdownEvent"/>.</param>
-        /// <exception cref="ArgumentOutOfRangeException"><paramref name="initialCount"/> is less than zero.</exception>
-        /// <remarks>
-        /// If <paramref name="initialCount"/> is <c>zero</c>, the event is created in a signaled state.
-        /// </remarks>
-        public CountdownEvent(int initialCount)
-        {
-            if (initialCount < 0)
-            {
-                throw new ArgumentOutOfRangeException("initialCount");
-            }
-
-            _count = initialCount;
-
-            var initialState = _count == 0;
-            _event = new ManualResetEvent(initialState);
-        }
-
-        /// <summary>
-        /// Gets the number of remaining signals required to set the event.
-        /// </summary>
-        /// <value>
-        /// The number of remaining signals required to set the event.
-        /// </value>
-        public int CurrentCount
-        {
-            get { return _count; }
-        }
-
-        /// <summary>
-        /// Indicates whether the <see cref="CountdownEvent"/>'s current count has reached zero.
-        /// </summary>
-        /// <value>
-        /// <c>true</c> if the current count is zero; otherwise, <c>false</c>.
-        /// </value>
-        public bool IsSet
-        {
-            get { return _count == 0; }
-        }
-
-        /// <summary>
-        /// Gets a <see cref="WaitHandle"/> that is used to wait for the event to be set.
-        /// </summary>
-        /// <value>
-        /// A <see cref="WaitHandle"/> that is used to wait for the event to be set.
-        /// </value>
-        /// <exception cref="ObjectDisposedException">The current instance has already been disposed.</exception>
-        public WaitHandle WaitHandle
-        {
-            get
-            {
-                EnsureNotDisposed();
-
-                return _event;
-            }
-        }
-
-
-        /// <summary>
-        /// Registers a signal with the <see cref="CountdownEvent"/>, decrementing the value of <see cref="CurrentCount"/>.
-        /// </summary>
-        /// <returns>
-        /// <c>true</c> if the signal caused the count to reach zero and the event was set; otherwise, <c>false</c>.
-        /// </returns>
-        /// <exception cref="ObjectDisposedException">The current instance has already been disposed.</exception>
-        /// <exception cref="InvalidOperationException">The current instance is already set.</exception>
-        public bool Signal()
-        {
-            EnsureNotDisposed();
-
-            if (_count <= 0)
-                throw new InvalidOperationException("Invalid attempt made to decrement the event's count below zero.");
-
-            var newCount = Interlocked.Decrement(ref _count);
-            if (newCount == 0)
-            {
-                _event.Set();
-                return true;
-            }
-
-            return false;
-        }
-
-        /// <summary>
-        /// Increments the <see cref="CountdownEvent"/>'s current count by one.
-        /// </summary>
-        /// <exception cref="ObjectDisposedException">The current instance has already been disposed.</exception>
-        /// <exception cref="InvalidOperationException">The current instance is already set.</exception>
-        /// <exception cref="InvalidOperationException"><see cref="CurrentCount"/> is equal to or greather than <see cref="int.MaxValue"/>.</exception>
-        public void AddCount()
-        {
-            EnsureNotDisposed();
-
-            if (_count == int.MaxValue)
-                throw new InvalidOperationException("TODO");
-
-            Interlocked.Increment(ref _count);
-        }
-
-        /// <summary>
-        /// Blocks the current thread until the <see cref="CountdownEvent"/> is set, using a <see cref="TimeSpan"/>
-        /// to measure the timeout.
-        /// </summary>
-        /// <param name="timeout">A <see cref="TimeSpan"/> that represents the number of milliseconds to wait, or a <see cref="TimeSpan"/> that represents -1 milliseconds to wait indefinitely.</param>
-        /// <returns>
-        /// <c>true</c> if the <see cref="CountdownEvent"/> was set; otherwise, <c>false</c>.
-        /// </returns>
-        /// <exception cref="ObjectDisposedException">The current instance has already been disposed.</exception>
-        public bool Wait(TimeSpan timeout)
-        {
-            EnsureNotDisposed();
-
-            return _event.WaitOne(timeout);
-        }
-
-        /// <summary>
-        /// Releases all resources used by the current instance of the <see cref="CountdownEvent"/> class.
-        /// </summary>
-        public void Dispose()
-        {
-            Dispose(true);
-            GC.SuppressFinalize(this);
-        }
-
-        /// <summary>
-        /// Releases the unmanaged resources used by the <see cref="CountdownEvent"/>, and optionally releases the managed resources.
-        /// </summary>
-        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
-        protected virtual void Dispose(bool disposing)
-        {
-            if (disposing)
-            {
-                var theEvent = _event;
-                if (theEvent != null)
-                {
-                    _event = null;
-                    theEvent.Dispose();
-                }
-
-                _disposed = true;
-            }
-        }
-
-        private void EnsureNotDisposed()
-        {
-            if (_disposed)
-                throw new ObjectDisposedException(GetType().Name);
-        }
-    }
-}
-
-#endif // FEATURE_THREAD_COUNTDOWNEVENT

+ 0 - 60
src/Renci.SshNet/Common/Extensions.cs

@@ -5,9 +5,6 @@ using System.Globalization;
 using System.Net;
 using System.Net.Sockets;
 using System.Text;
-#if !FEATURE_WAITHANDLE_DISPOSE
-using System.Threading;
-#endif // !FEATURE_WAITHANDLE_DISPOSE
 using Renci.SshNet.Abstractions;
 using Renci.SshNet.Messages;
 
@@ -305,62 +302,5 @@ namespace Renci.SshNet.Common
                 return false;
             return socket.Connected;
         }
-
-#if !FEATURE_SOCKET_DISPOSE
-        /// <summary>
-        /// Disposes the specified socket.
-        /// </summary>
-        /// <param name="socket">The socket.</param>
-        [DebuggerNonUserCode]
-        internal static void Dispose(this Socket socket)
-        {
-            if (socket == null)
-                throw new NullReferenceException();
-
-            socket.Close();
-        }
-#endif // !FEATURE_SOCKET_DISPOSE
-
-#if !FEATURE_WAITHANDLE_DISPOSE
-        /// <summary>
-        /// Disposes the specified handle.
-        /// </summary>
-        /// <param name="handle">The handle.</param>
-        [DebuggerNonUserCode]
-        internal static void Dispose(this WaitHandle handle)
-        {
-            if (handle == null)
-                throw new NullReferenceException();
-
-            handle.Close();
-        }
-#endif // !FEATURE_WAITHANDLE_DISPOSE
-
-#if !FEATURE_HASHALGORITHM_DISPOSE
-        /// <summary>
-        /// Disposes the specified algorithm.
-        /// </summary>
-        /// <param name="algorithm">The algorithm.</param>
-        [DebuggerNonUserCode]
-        internal static void Dispose(this System.Security.Cryptography.HashAlgorithm algorithm)
-        {
-            if (algorithm == null)
-                throw new NullReferenceException();
-
-            algorithm.Clear();
-        }
-#endif // FEATURE_HASHALGORITHM_DISPOSE
-
-#if !FEATURE_STRINGBUILDER_CLEAR
-        /// <summary>
-        /// Clears the contents of the string builder.
-        /// </summary>
-        /// <param name="value">The <see cref="StringBuilder"/> to clear.</param>
-        public static void Clear(this StringBuilder value)
-        {
-            value.Length = 0;
-            value.Capacity = 16;
-        }
-#endif // !FEATURE_STRINGBUILDER_CLEAR
     }
 }

+ 2 - 6
src/Renci.SshNet/Common/PacketDump.cs

@@ -79,13 +79,9 @@ namespace Renci.SshNet.Common
 
         private static string AsAscii(byte[] data, int length)
         {
-#if FEATURE_ENCODING_ASCII
-        var encoding = Encoding.ASCII;
-#else
-        var encoding = new ASCIIEncoding();
-#endif
+            var encoding = Encoding.ASCII;
 
-        var ascii = new StringBuilder();
+            var ascii = new StringBuilder();
             const char dot = '.';
 
             for (var i = 0; i < length; i++)

+ 1 - 4
src/Renci.SshNet/Common/SshData.cs

@@ -11,11 +11,8 @@ namespace Renci.SshNet.Common
     {
         internal const int DefaultCapacity = 64;
 
-#if FEATURE_ENCODING_ASCII
         internal static readonly Encoding Ascii = Encoding.ASCII;
-#else
-        internal static readonly Encoding Ascii = new ASCIIEncoding();
-#endif
+
         internal static readonly Encoding Utf8 = Encoding.UTF8;
 
         private SshDataStream _stream;

+ 0 - 6
src/Renci.SshNet/Common/SshDataStream.cs

@@ -252,13 +252,7 @@ namespace Renci.SshNet.Common
         {
             if (Capacity == Length)
             {
-#if FEATURE_MEMORYSTREAM_GETBUFFER
                 return GetBuffer();
-#elif FEATURE_MEMORYSTREAM_TRYGETBUFFER
-                ArraySegment<byte> buffer;
-                if (TryGetBuffer(out buffer))
-                    return buffer.Array;
-#endif
             }
             return base.ToArray();
         }

+ 0 - 7
src/Renci.SshNet/Connection/ConnectorBase.cs

@@ -5,10 +5,7 @@ using System;
 using System.Net;
 using System.Net.Sockets;
 using System.Threading;
-
-#if FEATURE_TAP
 using System.Threading.Tasks;
-#endif
 
 namespace Renci.SshNet.Connection
 {
@@ -26,9 +23,7 @@ namespace Renci.SshNet.Connection
 
         public abstract Socket Connect(IConnectionInfo connectionInfo);
 
-#if FEATURE_TAP
         public abstract Task<Socket> ConnectAsync(IConnectionInfo connectionInfo, CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Establishes a socket connection to the specified host and port.
@@ -63,7 +58,6 @@ namespace Renci.SshNet.Connection
             }
         }
 
-#if FEATURE_TAP
         /// <summary>
         /// Establishes a socket connection to the specified host and port.
         /// </summary>
@@ -97,7 +91,6 @@ namespace Renci.SshNet.Connection
                 throw;
             }
         }
-#endif
 
         protected static byte SocketReadByte(Socket socket)
         {

+ 0 - 2
src/Renci.SshNet/Connection/DirectConnector.cs

@@ -14,11 +14,9 @@ namespace Renci.SshNet.Connection
             return SocketConnect(connectionInfo.Host, connectionInfo.Port, connectionInfo.Timeout);
         }
 
-#if FEATURE_TAP
         public override System.Threading.Tasks.Task<Socket> ConnectAsync(IConnectionInfo connectionInfo, CancellationToken cancellationToken)
         {
             return SocketConnectAsync(connectionInfo.Host, connectionInfo.Port, cancellationToken);
         }
-#endif
     }
 }

+ 0 - 2
src/Renci.SshNet/Connection/IConnector.cs

@@ -7,8 +7,6 @@ namespace Renci.SshNet.Connection
     {
         Socket Connect(IConnectionInfo connectionInfo);
 
-#if FEATURE_TAP
         System.Threading.Tasks.Task<Socket> ConnectAsync(IConnectionInfo connectionInfo, CancellationToken cancellationToken);
-#endif
     }
 }

+ 0 - 2
src/Renci.SshNet/Connection/IProtocolVersionExchange.cs

@@ -19,8 +19,6 @@ namespace Renci.SshNet.Connection
         /// </returns>
         SshIdentification Start(string clientVersion, Socket socket, TimeSpan timeout);
 
-#if FEATURE_TAP
         System.Threading.Tasks.Task<SshIdentification> StartAsync(string clientVersion, Socket socket, System.Threading.CancellationToken cancellationToken);
-#endif
     }
 }

+ 0 - 11
src/Renci.SshNet/Connection/ProtocolVersionExchange.cs

@@ -8,9 +8,7 @@ using System.Net.Sockets;
 using System.Text;
 using System.Text.RegularExpressions;
 using System.Threading;
-#if FEATURE_TAP
 using System.Threading.Tasks;
-#endif
 
 namespace Renci.SshNet.Connection
 {
@@ -24,11 +22,7 @@ namespace Renci.SshNet.Connection
     {
         private const byte Null = 0x00;
 
-#if FEATURE_REGEX_COMPILE
         private static readonly Regex ServerVersionRe = new Regex("^SSH-(?<protoversion>[^-]+)-(?<softwareversion>.+?)([ ](?<comments>.+))?$", RegexOptions.Compiled);
-#else
-        private static readonly Regex ServerVersionRe = new Regex("^SSH-(?<protoversion>[^-]+)-(?<softwareversion>.+?)([ ](?<comments>.+))?$");
-#endif
 
         /// <summary>
         /// Performs the SSH protocol version exchange.
@@ -82,7 +76,6 @@ namespace Renci.SshNet.Connection
             }
         }
 
-#if FEATURE_TAP
         public async Task<SshIdentification> StartAsync(string clientVersion, Socket socket, CancellationToken cancellationToken)
         {
             // Immediately send the identification string since the spec states both sides MUST send an identification string
@@ -125,7 +118,6 @@ namespace Renci.SshNet.Connection
                 }
             }
         }
-#endif
 
         private static string GetGroupValue(Match match, string groupName)
         {
@@ -203,7 +195,6 @@ namespace Renci.SshNet.Connection
             return null;
         }
 
-#if FEATURE_TAP
         private static async Task<string> SocketReadLineAsync(Socket socket, CancellationToken cancellationToken, List<byte> buffer)
         {
             var data = new byte[1];
@@ -254,7 +245,5 @@ namespace Renci.SshNet.Connection
                 }
             }
         }
-#endif
-
     }
 }

+ 2 - 10
src/Renci.SshNet/Connection/ProxyConnector.cs

@@ -1,12 +1,8 @@
-#if !FEATURE_SOCKET_DISPOSE
-using Renci.SshNet.Common;
-#endif
-using System;
+using System;
 using System.Net.Sockets;
-#if FEATURE_TAP
 using System.Threading;
 using System.Threading.Tasks;
-#endif
+
 
 namespace Renci.SshNet.Connection
 {
@@ -19,7 +15,6 @@ namespace Renci.SshNet.Connection
 
         protected abstract void HandleProxyConnect(IConnectionInfo connectionInfo, Socket socket);
 
-#if FEATURE_TAP
         // ToDo: Performs async/sync fallback, true async version should be implemented in derived classes
         protected virtual Task HandleProxyConnectAsync(IConnectionInfo connectionInfo, Socket socket, CancellationToken cancellationToken)
         {
@@ -31,7 +26,6 @@ namespace Renci.SshNet.Connection
             }
             return Task.CompletedTask;
         }
-#endif
 
         public override Socket Connect(IConnectionInfo connectionInfo)
         {
@@ -51,7 +45,6 @@ namespace Renci.SshNet.Connection
             }
         }
 
-#if FEATURE_TAP
         public override async Task<Socket> ConnectAsync(IConnectionInfo connectionInfo, CancellationToken cancellationToken)
         {
             var socket = await SocketConnectAsync(connectionInfo.ProxyHost, connectionInfo.ProxyPort, cancellationToken).ConfigureAwait(false);
@@ -69,6 +62,5 @@ namespace Renci.SshNet.Connection
                 throw;
             }
         }
-#endif
     }
 }

+ 0 - 4
src/Renci.SshNet/Connection/Socks4Connector.cs

@@ -125,11 +125,7 @@ namespace Renci.SshNet.Connection
                 return Array<byte>.Empty;
             }
 
-#if FEATURE_ENCODING_ASCII
             return Encoding.ASCII.GetBytes(proxyUser);
-#else
-            return new ASCIIEncoding().GetBytes(proxyUser);
-#endif
         }
     }
 }

+ 0 - 2
src/Renci.SshNet/ConnectionInfo.cs

@@ -382,11 +382,9 @@ namespace Renci.SshNet
             HostKeyAlgorithms = new Dictionary<string, Func<byte[], KeyHostAlgorithm>>
                 {
                     {"ssh-ed25519", data => new KeyHostAlgorithm("ssh-ed25519", new ED25519Key(), data)},
-#if FEATURE_ECDSA
                     {"ecdsa-sha2-nistp256", data => new KeyHostAlgorithm("ecdsa-sha2-nistp256", new EcdsaKey(), data)},
                     {"ecdsa-sha2-nistp384", data => new KeyHostAlgorithm("ecdsa-sha2-nistp384", new EcdsaKey(), data)},
                     {"ecdsa-sha2-nistp521", data => new KeyHostAlgorithm("ecdsa-sha2-nistp521", new EcdsaKey(), data)},
-#endif
                     {"ssh-rsa", data => new KeyHostAlgorithm("ssh-rsa", new RsaKey(), data)},
                     {"ssh-dss", data => new KeyHostAlgorithm("ssh-dss", new DsaKey(), data)},
                     //{"x509v3-sign-rsa", () => { ... },

+ 0 - 4
src/Renci.SshNet/IBaseClient.cs

@@ -2,9 +2,7 @@
 using System;
 using System.Net.Sockets;
 using System.Threading;
-#if FEATURE_TAP
 using System.Threading.Tasks;
-#endif
 
 namespace Renci.SshNet
 {
@@ -68,7 +66,6 @@ namespace Renci.SshNet
         /// <exception cref="ProxyException">Failed to establish proxy connection.</exception>
         void Connect();
 
-#if FEATURE_TAP
         /// <summary>
         /// Asynchronously connects client to the server.
         /// </summary>
@@ -82,7 +79,6 @@ namespace Renci.SshNet
         /// <exception cref="SshAuthenticationException">Authentication of SSH session failed.</exception>
         /// <exception cref="ProxyException">Failed to establish proxy connection.</exception>
         Task ConnectAsync(CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Disconnects client from the server.

+ 0 - 4
src/Renci.SshNet/ISession.cs

@@ -6,9 +6,7 @@ using Renci.SshNet.Common;
 using Renci.SshNet.Messages;
 using Renci.SshNet.Messages.Authentication;
 using Renci.SshNet.Messages.Connection;
-#if FEATURE_TAP
 using System.Threading.Tasks;
-#endif
 
 namespace Renci.SshNet
 {
@@ -57,7 +55,6 @@ namespace Renci.SshNet
         /// <exception cref="ProxyException">Failed to establish proxy connection.</exception>
         void Connect();
 
-#if FEATURE_TAP
         /// <summary>
         /// Asynchronously connects to the server.
         /// </summary>
@@ -68,7 +65,6 @@ namespace Renci.SshNet
         /// <exception cref="SshAuthenticationException">Authentication of SSH session failed.</exception>
         /// <exception cref="ProxyException">Failed to establish proxy connection.</exception>
         Task ConnectAsync(CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Create a new SSH session channel.

+ 0 - 13
src/Renci.SshNet/ISftpClient.cs

@@ -4,10 +4,8 @@ using System.IO;
 using System.Text;
 using Renci.SshNet.Sftp;
 using Renci.SshNet.Common;
-#if FEATURE_TAP
 using System.Threading;
 using System.Threading.Tasks;
-#endif
 
 namespace Renci.SshNet
 {
@@ -492,7 +490,6 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         void DeleteFile(string path);
 
-#if FEATURE_TAP
         /// <summary>
         /// Asynchronously deletes remote file specified by path.
         /// </summary>
@@ -506,7 +503,6 @@ namespace Renci.SshNet
         /// <exception cref="SshException">A SSH error where <see cref="Exception.Message"/> is the message from the remote host.</exception>
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         Task DeleteFileAsync(string path, CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Downloads remote file specified by the path into the stream.
@@ -673,7 +669,6 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         SftpFileSytemInformation GetStatus(string path);
 
-#if FEATURE_TAP
         /// <summary>
         /// Asynchronously gets status using statvfs@openssh.com request.
         /// </summary>
@@ -687,7 +682,6 @@ namespace Renci.SshNet
         /// <exception cref="ArgumentNullException"><paramref name="path" /> is <b>null</b>.</exception>
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         Task<SftpFileSytemInformation> GetStatusAsync(string path, CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Retrieves list of files in remote directory.
@@ -704,8 +698,6 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         IEnumerable<ISftpFile> ListDirectory(string path, Action<int> listCallback = null);
 
-#if FEATURE_TAP
-
         /// <summary>
         /// Asynchronously retrieves list of files in remote directory.
         /// </summary>
@@ -721,7 +713,6 @@ namespace Renci.SshNet
         /// <exception cref="SshException">A SSH error where <see cref="Exception.Message" /> is the message from the remote host.</exception>
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         Task<IEnumerable<ISftpFile>> ListDirectoryAsync(string path, CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Opens a <see cref="SftpFileStream"/> on the specified path with read/write access.
@@ -750,7 +741,6 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         SftpFileStream Open(string path, FileMode mode, FileAccess access);
 
-#if FEATURE_TAP
         /// <summary>
         /// Asynchronously opens a <see cref="SftpFileStream"/> on the specified path, with the specified mode and access.
         /// </summary>
@@ -766,7 +756,6 @@ namespace Renci.SshNet
         /// <exception cref="SshConnectionException">Client is not connected.</exception>
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         Task<SftpFileStream> OpenAsync(string path, FileMode mode, FileAccess access, CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Opens an existing file for reading.
@@ -906,7 +895,6 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         void RenameFile(string oldPath, string newPath);
 
-#if FEATURE_TAP
         /// <summary>
         /// Asynchronously renames remote file from old path to new path.
         /// </summary>
@@ -920,7 +908,6 @@ namespace Renci.SshNet
         /// <exception cref="SshException">A SSH error where <see cref="Exception.Message"/> is the message from the remote host.</exception>
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         Task RenameFileAsync(string oldPath, string newPath, CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Renames remote file from old path to new path.

+ 0 - 3
src/Renci.SshNet/NoneAuthenticationMethod.cs

@@ -1,8 +1,5 @@
 using System;
 using System.Threading;
-#if !FEATURE_WAITHANDLE_DISPOSE
-using Renci.SshNet.Common;
-#endif // !FEATURE_WAITHANDLE_DISPOSE
 using Renci.SshNet.Messages.Authentication;
 using Renci.SshNet.Messages;
 

+ 1 - 8
src/Renci.SshNet/PrivateKeyFile.cs

@@ -66,11 +66,8 @@ namespace Renci.SshNet
     public class PrivateKeyFile : IPrivateKeySource, IDisposable
     {
         private static readonly Regex PrivateKeyRegex = new Regex(@"^-+ *BEGIN (?<keyName>\w+( \w+)*) PRIVATE KEY *-+\r?\n((Proc-Type: 4,ENCRYPTED\r?\nDEK-Info: (?<cipherName>[A-Z0-9-]+),(?<salt>[A-F0-9]+)\r?\n\r?\n)|(Comment: ""?[^\r\n]*""?\r?\n))?(?<data>([a-zA-Z0-9/+=]{1,80}\r?\n)+)-+ *END \k<keyName> PRIVATE KEY *-+",
-#if FEATURE_REGEX_COMPILE
             RegexOptions.Compiled | RegexOptions.Multiline);
-#else
-            RegexOptions.Multiline);
-#endif
+
 
         private Key _key;
 
@@ -221,12 +218,10 @@ namespace Renci.SshNet
                     _key = new DsaKey(decryptedData);
                     HostKey = new KeyHostAlgorithm("ssh-dss", _key);
                     break;
-#if FEATURE_ECDSA
                 case "EC":
                     _key = new EcdsaKey(decryptedData);
                     HostKey = new KeyHostAlgorithm(_key.ToString(), _key);
                     break;
-#endif
                 case "OPENSSH":
                     _key = ParseOpenSshV1Key(decryptedData, passPhrase);
                     HostKey = new KeyHostAlgorithm(_key.ToString(), _key);
@@ -497,7 +492,6 @@ namespace Renci.SshNet
                     unencryptedPrivateKey = privateKeyReader.ReadBignum2();
                     parsedKey = new ED25519Key(publicKey.Reverse(), unencryptedPrivateKey);
                     break;
-#if FEATURE_ECDSA
                 case "ecdsa-sha2-nistp256":
                 case "ecdsa-sha2-nistp384":
                 case "ecdsa-sha2-nistp521":
@@ -510,7 +504,6 @@ namespace Renci.SshNet
                     unencryptedPrivateKey = privateKeyReader.ReadBignum2();
                     parsedKey = new EcdsaKey(curve, publicKey, unencryptedPrivateKey.TrimLeadingZeros());
                     break;
-#endif
                 case "ssh-rsa":
                     var modulus = privateKeyReader.ReadBignum(); //n
                     var exponent = privateKeyReader.ReadBignum(); //e

+ 2 - 2
src/Renci.SshNet/Renci.SshNet.csproj

@@ -11,7 +11,7 @@
   </PropertyGroup>
 
   <PropertyGroup Condition=" '$(TargetFramework)' == 'net462' ">
-    <DefineConstants>FEATURE_STRINGBUILDER_CLEAR;FEATURE_HASHALGORITHM_DISPOSE;FEATURE_REGEX_COMPILE;FEATURE_BINARY_SERIALIZATION;FEATURE_RNG_CREATE;FEATURE_SOCKET_SYNC;FEATURE_SOCKET_EAP;FEATURE_SOCKET_APM;FEATURE_SOCKET_SELECT;FEATURE_SOCKET_POLL;FEATURE_SOCKET_DISPOSE;FEATURE_STREAM_APM;FEATURE_DNS_SYNC;FEATURE_THREAD_COUNTDOWNEVENT;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_WAITHANDLE_DISPOSE;FEATURE_HASH_MD5;FEATURE_HASH_SHA1_CREATE;FEATURE_HASH_SHA256_CREATE;FEATURE_HASH_SHA384_CREATE;FEATURE_HASH_SHA512_CREATE;FEATURE_HASH_RIPEMD160_CREATE;FEATURE_HMAC_MD5;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256;FEATURE_HMAC_SHA384;FEATURE_HMAC_SHA512;FEATURE_HMAC_RIPEMD160;FEATURE_MEMORYSTREAM_GETBUFFER;FEATURE_DIAGNOSTICS_TRACESOURCE;FEATURE_ENCODING_ASCII;FEATURE_ECDSA;FEATURE_TAP</DefineConstants>
+    <DefineConstants>FEATURE_BINARY_SERIALIZATION;FEATURE_SOCKET_EAP;FEATURE_SOCKET_APM;FEATURE_DNS_SYNC;FEATURE_HASH_RIPEMD160_CREATE;FEATURE_HMAC_RIPEMD160</DefineConstants>
   </PropertyGroup>
 
   <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' ">
@@ -19,6 +19,6 @@
   </ItemGroup>
 
   <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' ">
-    <DefineConstants>FEATURE_STRINGBUILDER_CLEAR;FEATURE_HASHALGORITHM_DISPOSE;FEATURE_ENCODING_ASCII;FEATURE_DIAGNOSTICS_TRACESOURCE;FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_MEMORYSTREAM_GETBUFFER;FEATURE_MEMORYSTREAM_TRYGETBUFFER;FEATURE_RNG_CREATE;FEATURE_SOCKET_TAP;FEATURE_SOCKET_APM;FEATURE_SOCKET_EAP;FEATURE_SOCKET_SYNC;FEATURE_SOCKET_SELECT;FEATURE_SOCKET_POLL;FEATURE_SOCKET_DISPOSE;FEATURE_DNS_SYNC;FEATURE_DNS_APM;FEATURE_DNS_TAP;FEATURE_STREAM_APM;FEATURE_STREAM_TAP;FEATURE_THREAD_COUNTDOWNEVENT;FEATURE_THREAD_TAP;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_WAITHANDLE_DISPOSE;FEATURE_HASH_MD5;FEATURE_HASH_SHA1_CREATE;FEATURE_HASH_SHA256_CREATE;FEATURE_HASH_SHA384_CREATE;FEATURE_HASH_SHA512_CREATE;FEATURE_HMAC_MD5;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256;FEATURE_HMAC_SHA384;FEATURE_HMAC_SHA512;FEATURE_ECDSA;FEATURE_TAP</DefineConstants>
+    <DefineConstants>FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_SOCKET_TAP;FEATURE_SOCKET_APM;FEATURE_SOCKET_EAP;FEATURE_DNS_SYNC;FEATURE_DNS_APM;FEATURE_DNS_TAP</DefineConstants>
   </PropertyGroup>
 </Project>

+ 0 - 10
src/Renci.SshNet/Security/BouncyCastle/crypto/prng/CryptoApiRandomGenerator.cs

@@ -9,9 +9,7 @@ namespace Renci.SshNet.Security.Org.BouncyCastle.Crypto.Prng
         private readonly RandomNumberGenerator rndProv;
 
         public CryptoApiRandomGenerator()
-#if FEATURE_RNG_CREATE || FEATURE_RNG_CSP
             : this(Abstractions.CryptoAbstraction.CreateRandomNumberGenerator())
-#endif
         {
         }
 
@@ -34,15 +32,7 @@ namespace Renci.SshNet.Security.Org.BouncyCastle.Crypto.Prng
 
         public virtual void NextBytes(byte[] bytes)
         {
-#if FEATURE_RNG_CREATE || FEATURE_RNG_CSP
             rndProv.GetBytes(bytes);
-#else
-            if (bytes == null)
-                throw new ArgumentNullException("bytes");
-
-            var buffer = Windows.Security.Cryptography.CryptographicBuffer.GenerateRandom((uint)bytes.Length);
-            System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeBufferExtensions.CopyTo(buffer, bytes);
-#endif
         }
 
         public virtual void NextBytes(byte[] bytes, int start, int len)

+ 2 - 6
src/Renci.SshNet/Security/Cryptography/Bcrypt.cs

@@ -499,14 +499,10 @@ namespace Renci.SshNet.Security.Cryptography
                 throw new ArgumentOutOfRangeException("workFactor", "The work factor must be between 4 and 31 (inclusive)");
 
             byte[] rnd = new byte[BCRYPT_SALT_LEN];
-#if FEATURE_RNG_CREATE
+
             RandomNumberGenerator rng = RandomNumberGenerator.Create();
-#elif FEATURE_RNG_CSP
-            RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
-#endif
-#if FEATURE_RNG_CREATE || FEATURE_RNG_CSP
+
             rng.GetBytes(rnd);
-#endif
 
             StringBuilder rs = new StringBuilder();
             rs.AppendFormat("$2a${0:00}$", workFactor);

+ 1 - 3
src/Renci.SshNet/Security/Cryptography/EcdsaDigitalSignature.cs

@@ -1,5 +1,4 @@
-#if FEATURE_ECDSA
-using System;
+using System;
 using Renci.SshNet.Common;
 using System.Globalization;
 using System.Security.Cryptography;
@@ -186,4 +185,3 @@ namespace Renci.SshNet.Security.Cryptography
         }
     }
 }
-#endif

+ 1 - 3
src/Renci.SshNet/Security/Cryptography/EcdsaKey.cs

@@ -1,5 +1,4 @@
-#if FEATURE_ECDSA
-using System;
+using System;
 using System.IO;
 using System.Text;
 using System.Runtime.InteropServices;
@@ -467,4 +466,3 @@ namespace Renci.SshNet.Security
         #endregion
     }
 }
-#endif

+ 1 - 5
src/Renci.SshNet/Security/Cryptography/HMACMD5.cs

@@ -1,6 +1,4 @@
-#if FEATURE_HMAC_MD5
-
-using System.Security.Cryptography;
+using System.Security.Cryptography;
 using Renci.SshNet.Common;
 
 namespace Renci.SshNet.Security.Cryptography
@@ -57,5 +55,3 @@ namespace Renci.SshNet.Security.Cryptography
         }
     }
 }
-
-#endif // FEATURE_HMAC_MD5

+ 1 - 5
src/Renci.SshNet/Security/Cryptography/HMACSHA1.cs

@@ -1,6 +1,4 @@
-#if FEATURE_HMAC_SHA1
-
-using System.Security.Cryptography;
+using System.Security.Cryptography;
 using Renci.SshNet.Common;
 
 namespace Renci.SshNet.Security.Cryptography
@@ -57,5 +55,3 @@ namespace Renci.SshNet.Security.Cryptography
         }
     }
 }
-
-#endif // FEATURE_HMAC_SHA1

+ 1 - 5
src/Renci.SshNet/Security/Cryptography/HMACSHA256.cs

@@ -1,6 +1,4 @@
-#if FEATURE_HMAC_SHA256
-
-using System.Security.Cryptography;
+using System.Security.Cryptography;
 using Renci.SshNet.Common;
 
 namespace Renci.SshNet.Security.Cryptography
@@ -58,5 +56,3 @@ namespace Renci.SshNet.Security.Cryptography
         }
     }
 }
-
-#endif // FEATURE_HMAC_SHA256

+ 1 - 5
src/Renci.SshNet/Security/Cryptography/HMACSHA384.cs

@@ -1,6 +1,4 @@
-#if FEATURE_HMAC_SHA384
-
-using System.Security.Cryptography;
+using System.Security.Cryptography;
 using Renci.SshNet.Common;
 
 namespace Renci.SshNet.Security.Cryptography
@@ -57,5 +55,3 @@ namespace Renci.SshNet.Security.Cryptography
         }
     }
 }
-
-#endif // FEATURE_HMAC_SHA384

+ 1 - 5
src/Renci.SshNet/Security/Cryptography/HMACSHA512.cs

@@ -1,6 +1,4 @@
-#if FEATURE_HMAC_SHA512
-
-using System.Security.Cryptography;
+using System.Security.Cryptography;
 using Renci.SshNet.Common;
 
 namespace Renci.SshNet.Security.Cryptography
@@ -57,5 +55,3 @@ namespace Renci.SshNet.Security.Cryptography
         }
     }
 }
-
-#endif // FEATURE_HMAC_SHA512

+ 0 - 67
src/Renci.SshNet/Session.cs

@@ -16,9 +16,7 @@ using System.Globalization;
 using System.Linq;
 using Renci.SshNet.Abstractions;
 using Renci.SshNet.Security.Cryptography;
-#if FEATURE_TAP
 using System.Threading.Tasks;
-#endif
 
 namespace Renci.SshNet
 {
@@ -172,13 +170,11 @@ namespace Renci.SshNet
         /// </summary>
         private Socket _socket;
 
-#if FEATURE_SOCKET_POLL
         /// <summary>
         /// Holds an object that is used to ensure only a single thread can read from
         /// <see cref="_socket"/> at any given time.
         /// </summary>
         private readonly object _socketReadLock = new object();
-#endif // FEATURE_SOCKET_POLL
 
         /// <summary>
         /// Holds an object that is used to ensure only a single thread can write to
@@ -673,7 +669,6 @@ namespace Renci.SshNet
             }
         }
 
-#if FEATURE_TAP
         /// <summary>
         /// Asynchronously connects to the server.
         /// </summary>
@@ -777,7 +772,6 @@ namespace Renci.SshNet
             RegisterMessage("SSH_MSG_CHANNEL_EOF");
             RegisterMessage("SSH_MSG_CHANNEL_CLOSE");
         }
-#endif
 
         /// <summary>
         /// Disconnects from the server.
@@ -1150,13 +1144,11 @@ namespace Renci.SshNet
             byte[] data;
             uint packetLength;
 
-#if FEATURE_SOCKET_POLL
             // avoid reading from socket while IsSocketConnected is attempting to determine whether the
             // socket is still connected by invoking Socket.Poll(...) and subsequently verifying value of
             // Socket.Available
             lock (_socketReadLock)
             {
-#endif // FEATURE_SOCKET_POLL
                 //  Read first block - which starts with the packet length
                 var firstBlock = new byte[blockSize];
                 if (TrySocketRead(socket, firstBlock, 0, blockSize) == 0)
@@ -1204,9 +1196,7 @@ namespace Renci.SshNet
                         return null;
                     }
                 }
-#if FEATURE_SOCKET_POLL
             }
-#endif // FEATURE_SOCKET_POLL
 
             if (_serverCipher != null)
             {
@@ -1767,7 +1757,6 @@ namespace Renci.SshNet
 
         #endregion
 
-#if FEATURE_SOCKET_POLL
         /// <summary>
         /// Gets a value indicating whether the socket is connected.
         /// </summary>
@@ -1807,23 +1796,10 @@ namespace Renci.SshNet
         /// we synchronize reads from the <see cref="Socket"/>.
         /// </para>
         /// </remarks>
-#else
-        /// <summary>
-        /// Gets a value indicating whether the socket is connected.
-        /// </summary>
-        /// <returns>
-        /// <c>true</c> if the socket is connected; otherwise, <c>false</c>.
-        /// </returns>
-        /// <remarks>
-        /// We verify whether <see cref="Socket.Connected"/> is <c>true</c>. However, this only returns the state
-        /// of the socket as of the last I/O operation.
-        /// </remarks>
-#endif
         private bool IsSocketConnected()
         {
             lock (_socketDisposeLock)
             {
-#if FEATURE_SOCKET_POLL
                 if (!_socket.IsConnected())
                 {
                     return false;
@@ -1834,9 +1810,6 @@ namespace Renci.SshNet
                     var connectionClosedOrDataAvailable = _socket.Poll(0, SelectMode.SelectRead);
                     return !(connectionClosedOrDataAvailable && _socket.Available == 0);
                 }
-#else
-                return _socket.IsConnected();
-#endif // FEATURE_SOCKET_POLL
             }
         }
 
@@ -1915,10 +1888,8 @@ namespace Renci.SshNet
                         break;
                     }
 
-#if FEATURE_SOCKET_POLL || FEATURE_SOCKET_SELECT
                     try
                     {
-#if FEATURE_SOCKET_POLL
                         // Block until either data is available or the socket is closed
                         var connectionClosedOrDataAvailable = socket.Poll(-1, SelectMode.SelectRead);
                         if (connectionClosedOrDataAvailable && socket.Available == 0)
@@ -1926,43 +1897,6 @@ namespace Renci.SshNet
                             // connection with SSH server was closed or connection was reset
                             break;
                         }
-#elif FEATURE_SOCKET_SELECT
-                        var readSockets = new List<Socket> { socket };
-
-                        // if the socket is already disposed when Select is invoked, then a SocketException
-                        // stating "An operation was attempted on something that is not a socket" is thrown;
-                        // we attempt to avoid this exception by having an IsConnected() that can break the
-                        // message loop
-                        //
-                        // note that there's no guarantee that the socket will not be disposed between the
-                        // IsConnected() check and the Select invocation; we can't take a "dispose" lock
-                        // that includes the Select invocation as we want Dispose() to be able to interrupt
-                        // the Select
-
-                        // perform a blocking select to determine whether there's is data available to be
-                        // read; we do not use a blocking read to allow us to use Socket.Poll to determine
-                        // if the connection is still available (in IsSocketConnected)
-
-                        Socket.Select(readSockets, null, null, -1);
-
-                        // the Select invocation will be interrupted in one of the following conditions:
-                        // * data is available to be read
-                        //   => the socket will not be removed from "readSockets"
-                        // * the socket connection is closed during the Select invocation
-                        //   => the socket will be removed from "readSockets"
-                        // * the socket is disposed during the Select invocation
-                        //   => the socket will not be removed from "readSocket"
-                        // 
-                        // since we handle the second and third condition the same way and Socket.Connected
-                        // allows us to check for both conditions, we use that instead of both checking for
-                        // the removal from "readSockets" and the Connection check
-                        if (!socket.IsConnected())
-                        {
-                            // connection with SSH server was closed or socket was disposed;
-                            // break out of the message loop
-                            break;
-                        }
-#endif // FEATURE_SOCKET_SELECT
                     }
                     catch (ObjectDisposedException)
                     {
@@ -1972,7 +1906,6 @@ namespace Renci.SshNet
                         // * a SSH_MSG_DISCONNECT received from server
                         break;
                     }
-#endif // FEATURE_SOCKET_POLL || FEATURE_SOCKET_SELECT
 
                     var message = ReceiveMessage(socket);
                     if (message == null)

+ 0 - 24
src/Renci.SshNet/Sftp/ISftpSession.cs

@@ -2,9 +2,7 @@
 using System.Collections.Generic;
 using System.Threading;
 using Renci.SshNet.Sftp.Responses;
-#if FEATURE_TAP
 using System.Threading.Tasks;
-#endif
 
 namespace Renci.SshNet.Sftp
 {
@@ -41,9 +39,7 @@ namespace Renci.SshNet.Sftp
         /// </returns>
         string GetCanonicalPath(string path);
 
-#if FEATURE_TAP
         Task<string> GetCanonicalPathAsync(string path, CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Performs SSH_FXP_FSTAT request.
@@ -55,9 +51,7 @@ namespace Renci.SshNet.Sftp
         /// </returns>
         SftpFileAttributes RequestFStat(byte[] handle, bool nullOnError);
 
-#if FEATURE_TAP
         Task<SftpFileAttributes> RequestFStatAsync(byte[] handle, CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Performs SSH_FXP_STAT request.
@@ -135,9 +129,7 @@ namespace Renci.SshNet.Sftp
         /// <returns>File handle.</returns>
         byte[] RequestOpen(string path, Flags flags, bool nullOnError = false);
 
-#if FEATURE_TAP
         Task<byte[]> RequestOpenAsync(string path, Flags flags, CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Performs SSH_FXP_OPEN request
@@ -173,9 +165,7 @@ namespace Renci.SshNet.Sftp
         /// <returns>File handle.</returns>
         byte[] RequestOpenDir(string path, bool nullOnError = false);
 
-#if FEATURE_TAP
         Task<byte[]> RequestOpenDirAsync(string path, CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Performs posix-rename@openssh.com extended request.
@@ -220,9 +210,7 @@ namespace Renci.SshNet.Sftp
         /// <exception cref="ArgumentNullException"><paramref name="asyncResult"/> is <c>null</c>.</exception>
         byte[] EndRead(SftpReadAsyncResult asyncResult);
 
-#if FEATURE_TAP
         Task<byte[]> RequestReadAsync(byte[] handle, ulong offset, uint length, CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Performs SSH_FXP_READDIR request
@@ -231,9 +219,7 @@ namespace Renci.SshNet.Sftp
         /// <returns></returns>
         KeyValuePair<string, SftpFileAttributes>[] RequestReadDir(byte[] handle);
 
-#if FEATURE_TAP
         Task<KeyValuePair<string, SftpFileAttributes>[]> RequestReadDirAsync(byte[] handle, CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Performs SSH_FXP_REALPATH request.
@@ -262,9 +248,7 @@ namespace Renci.SshNet.Sftp
         /// <param name="path">The path.</param>
         void RequestRemove(string path);
 
-#if FEATURE_TAP
         Task RequestRemoveAsync(string path, CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Performs SSH_FXP_RENAME request.
@@ -273,9 +257,7 @@ namespace Renci.SshNet.Sftp
         /// <param name="newPath">The new path.</param>
         void RequestRename(string oldPath, string newPath);
 
-#if FEATURE_TAP
         Task RequestRenameAsync(string oldPath, string newPath, CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Performs SSH_FXP_RMDIR request.
@@ -298,9 +280,7 @@ namespace Renci.SshNet.Sftp
         /// <returns></returns>
         SftpFileSytemInformation RequestStatVfs(string path, bool nullOnError = false);
 
-#if FEATURE_TAP
         Task<SftpFileSytemInformation> RequestStatVfsAsync(string path, CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Performs SSH_FXP_SYMLINK request.
@@ -334,9 +314,7 @@ namespace Renci.SshNet.Sftp
                           AutoResetEvent wait,
                           Action<SftpStatusResponse> writeCompleted = null);
 
-#if FEATURE_TAP
         Task RequestWriteAsync(byte[] handle, ulong serverOffset, byte[] data, int offset, int length, CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Performs SSH_FXP_CLOSE request.
@@ -344,9 +322,7 @@ namespace Renci.SshNet.Sftp
         /// <param name="handle">The handle.</param>
         void RequestClose(byte[] handle);
 
-#if FEATURE_TAP
         Task RequestCloseAsync(byte[] handle, CancellationToken cancellationToken);
-#endif
 
         /// <summary>
         /// Performs SSH_FXP_CLOSE request.

+ 1 - 12
src/Renci.SshNet/Sftp/SftpFileStream.cs

@@ -3,9 +3,7 @@ using System.IO;
 using System.Threading;
 using System.Diagnostics.CodeAnalysis;
 using Renci.SshNet.Common;
-#if FEATURE_TAP
 using System.Threading.Tasks;
-#endif
 
 namespace Renci.SshNet.Sftp
 {
@@ -293,7 +291,6 @@ namespace Renci.SshNet.Sftp
             }
         }
 
-#if FEATURE_TAP
         internal static async Task<SftpFileStream> OpenAsync(ISftpSession session, string path, FileMode mode, FileAccess access, int bufferSize, CancellationToken cancellationToken)
         {
             if (session == null)
@@ -390,7 +387,6 @@ namespace Renci.SshNet.Sftp
 
             return new SftpFileStream(session, path, access, bufferSize, handle, position);
         }
-#endif
 
         /// <summary>
         /// Releases unmanaged resources and performs other cleanup operations before the
@@ -423,7 +419,6 @@ namespace Renci.SshNet.Sftp
             }
         }
 
-#if FEATURE_TAP
         /// <summary>
         /// Asynchronously clears all buffers for this stream and causes any buffered data to be written to the file.
         /// </summary>
@@ -446,7 +441,6 @@ namespace Renci.SshNet.Sftp
 
             return Task.CompletedTask;
         }
-#endif
 
         /// <summary>
         /// Reads a sequence of bytes from the current stream and advances the position within the stream by the
@@ -588,7 +582,6 @@ namespace Renci.SshNet.Sftp
             return readLen;
         }
 
-#if FEATURE_TAP
         /// <summary>
         /// Asynchronously reads a sequence of bytes from the current stream and advances the position within the stream by the
         /// number of bytes read.
@@ -700,7 +693,6 @@ namespace Renci.SshNet.Sftp
             // return the number of bytes that were read to the caller.
             return readLen;
         }
-#endif
 
         /// <summary>
         /// Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
@@ -986,7 +978,7 @@ namespace Renci.SshNet.Sftp
             }
         }
 
-#if FEATURE_TAP
+
         /// <summary>
         /// Asynchronously writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
         /// </summary>
@@ -1062,7 +1054,6 @@ namespace Renci.SshNet.Sftp
                 _bufferPosition = 0;
             }
         }
-#endif
 
         /// <summary>
         /// Writes a byte to the current position in the stream and advances the position within the stream by one byte.
@@ -1181,7 +1172,6 @@ namespace Renci.SshNet.Sftp
             }
         }
 
-#if FEATURE_TAP
         private async Task FlushWriteBufferAsync(CancellationToken cancellationToken)
         {
             if (_bufferPosition > 0)
@@ -1190,7 +1180,6 @@ namespace Renci.SshNet.Sftp
                 _bufferPosition = 0;
             }
         }
-#endif
 
         /// <summary>
         /// Setups the read.

+ 0 - 31
src/Renci.SshNet/Sftp/SftpSession.cs

@@ -6,9 +6,7 @@ using System.Collections.Generic;
 using System.Globalization;
 using Renci.SshNet.Sftp.Responses;
 using Renci.SshNet.Sftp.Requests;
-#if FEATURE_TAP
 using System.Threading.Tasks;
-#endif
 
 namespace Renci.SshNet.Sftp
 {
@@ -139,7 +137,6 @@ namespace Renci.SshNet.Sftp
             return string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}", canonizedPath, slash, pathParts[pathParts.Length - 1]);
         }
 
-#if FEATURE_TAP
         public async Task<string> GetCanonicalPathAsync(string path, CancellationToken cancellationToken)
         {
             var fullPath = GetFullRemotePath(path);
@@ -185,7 +182,6 @@ namespace Renci.SshNet.Sftp
                 slash = "/";
             return canonizedPath + slash + pathParts[pathParts.Length - 1];
         }
-#endif
 
         public ISftpFileReader CreateFileReader(byte[] handle, ISftpSession sftpSession, uint chunkSize, int maxPendingReads, long? fileSize)
         {
@@ -436,7 +432,6 @@ namespace Renci.SshNet.Sftp
             return handle;
         }
 
-#if FEATURE_TAP
         public async Task<byte[]> RequestOpenAsync(string path, Flags flags, CancellationToken cancellationToken)
         {
             cancellationToken.ThrowIfCancellationRequested();
@@ -452,7 +447,6 @@ namespace Renci.SshNet.Sftp
                 return await tcs.Task.ConfigureAwait(false);
             }
         }
-#endif
 
         /// <summary>
         /// Performs SSH_FXP_OPEN request
@@ -541,7 +535,6 @@ namespace Renci.SshNet.Sftp
             }
         }
 
-#if FEATURE_TAP
         public async Task RequestCloseAsync(byte[] handle, CancellationToken cancellationToken)
         {
             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
@@ -566,8 +559,6 @@ namespace Renci.SshNet.Sftp
                 await tcs.Task.ConfigureAwait(false);
             }
         }
-#endif
-
 
         /// <summary>
         /// Performs SSH_FXP_CLOSE request.
@@ -732,7 +723,6 @@ namespace Renci.SshNet.Sftp
             return data;
         }
 
-#if FEATURE_TAP
         public async Task<byte[]> RequestReadAsync(byte[] handle, ulong offset, uint length, CancellationToken cancellationToken)
         {
             cancellationToken.ThrowIfCancellationRequested();
@@ -758,7 +748,6 @@ namespace Renci.SshNet.Sftp
                 return await tcs.Task.ConfigureAwait(false);
             }
         }
-#endif
 
         /// <summary>
         /// Performs SSH_FXP_WRITE request.
@@ -804,7 +793,6 @@ namespace Renci.SshNet.Sftp
             }
         }
 
-#if FEATURE_TAP
         public async Task RequestWriteAsync(byte[] handle, ulong serverOffset, byte[] data, int offset, int length, CancellationToken cancellationToken)
         {
             cancellationToken.ThrowIfCancellationRequested();
@@ -829,7 +817,6 @@ namespace Renci.SshNet.Sftp
                 await tcs.Task.ConfigureAwait(false);
             }
         }
-#endif
 
         /// <summary>
         /// Performs SSH_FXP_LSTAT request.
@@ -963,7 +950,6 @@ namespace Renci.SshNet.Sftp
             return attributes;
         }
 
-#if FEATURE_TAP
         public async Task<SftpFileAttributes> RequestFStatAsync(byte[] handle, CancellationToken cancellationToken)
         {
             cancellationToken.ThrowIfCancellationRequested();
@@ -979,7 +965,6 @@ namespace Renci.SshNet.Sftp
                 return await tcs.Task.ConfigureAwait(false);
             }
         }
-#endif
 
         /// <summary>
         /// Performs SSH_FXP_SETSTAT request.
@@ -1078,7 +1063,6 @@ namespace Renci.SshNet.Sftp
             return handle;
         }
 
-#if FEATURE_TAP
         public async Task<byte[]> RequestOpenDirAsync(string path, CancellationToken cancellationToken)
         {
             cancellationToken.ThrowIfCancellationRequested();
@@ -1094,7 +1078,6 @@ namespace Renci.SshNet.Sftp
                 return await tcs.Task.ConfigureAwait(false);
             }
         }
-#endif
 
         /// <summary>
         /// Performs SSH_FXP_READDIR request
@@ -1137,7 +1120,6 @@ namespace Renci.SshNet.Sftp
             return result;
         }
 
-#if FEATURE_TAP
         public async Task<KeyValuePair<string, SftpFileAttributes>[]> RequestReadDirAsync(byte[] handle, CancellationToken cancellationToken)
         {
             cancellationToken.ThrowIfCancellationRequested();
@@ -1163,8 +1145,6 @@ namespace Renci.SshNet.Sftp
                 return await tcs.Task.ConfigureAwait(false);
             }
         }
-#endif
-
 
         /// <summary>
         /// Performs SSH_FXP_REMOVE request.
@@ -1194,7 +1174,6 @@ namespace Renci.SshNet.Sftp
             }
         }
 
-#if FEATURE_TAP
         public async Task RequestRemoveAsync(string path, CancellationToken cancellationToken)
         {
             cancellationToken.ThrowIfCancellationRequested();
@@ -1219,8 +1198,6 @@ namespace Renci.SshNet.Sftp
                 await tcs.Task.ConfigureAwait(false);
             }
         }
-#endif
-
 
         /// <summary>
         /// Performs SSH_FXP_MKDIR request.
@@ -1319,7 +1296,6 @@ namespace Renci.SshNet.Sftp
             return result;
         }
 
-#if FEATURE_TAP
         internal async Task<KeyValuePair<string, SftpFileAttributes>[]> RequestRealPathAsync(string path, bool nullOnError, CancellationToken cancellationToken)
         {
             cancellationToken.ThrowIfCancellationRequested();
@@ -1345,7 +1321,6 @@ namespace Renci.SshNet.Sftp
                 return await tcs.Task.ConfigureAwait(false);
             }
         }
-#endif
 
         /// <summary>
         /// Performs SSH_FXP_REALPATH request.
@@ -1528,8 +1503,6 @@ namespace Renci.SshNet.Sftp
             }
         }
 
-
-#if FEATURE_TAP
         public async Task RequestRenameAsync(string oldPath, string newPath, CancellationToken cancellationToken)
         {
             cancellationToken.ThrowIfCancellationRequested();
@@ -1554,7 +1527,6 @@ namespace Renci.SshNet.Sftp
                 await tcs.Task.ConfigureAwait(false);
             }
         }
-#endif
 
         /// <summary>
         /// Performs SSH_FXP_READLINK request.
@@ -1722,8 +1694,6 @@ namespace Renci.SshNet.Sftp
             return information;
         }
 
-
-#if FEATURE_TAP
         public async Task<SftpFileSytemInformation> RequestStatVfsAsync(string path, CancellationToken cancellationToken)
         {
             if (ProtocolVersion < 3)
@@ -1744,7 +1714,6 @@ namespace Renci.SshNet.Sftp
                 return await tcs.Task.ConfigureAwait(false);
             }
         }
-#endif
 
         /// <summary>
         /// Performs fstatvfs@openssh.com extended request.

+ 0 - 14
src/Renci.SshNet/SftpClient.cs

@@ -10,9 +10,7 @@ using System.Threading;
 using Renci.SshNet.Abstractions;
 using Renci.SshNet.Common;
 using Renci.SshNet.Sftp;
-#if FEATURE_TAP
 using System.Threading.Tasks;
-#endif
 
 namespace Renci.SshNet
 {
@@ -376,7 +374,6 @@ namespace Renci.SshNet
             _sftpSession.RequestRemove(fullPath);
         }
 
-#if FEATURE_TAP
         /// <summary>
         /// Asynchronously deletes remote file specified by path.
         /// </summary>
@@ -401,7 +398,6 @@ namespace Renci.SshNet
             var fullPath = await _sftpSession.GetCanonicalPathAsync(path, cancellationToken).ConfigureAwait(false);
             await _sftpSession.RequestRemoveAsync(fullPath, cancellationToken).ConfigureAwait(false);
         }
-#endif
 
         /// <summary>
         /// Renames remote file from old path to new path.
@@ -418,7 +414,6 @@ namespace Renci.SshNet
             RenameFile(oldPath, newPath, false);
         }
 
-#if FEATURE_TAP
         /// <summary>
         /// Asynchronously renames remote file from old path to new path.
         /// </summary>
@@ -446,7 +441,6 @@ namespace Renci.SshNet
             var newFullPath = await _sftpSession.GetCanonicalPathAsync(newPath, cancellationToken).ConfigureAwait(false);
             await _sftpSession.RequestRenameAsync(oldFullPath, newFullPath, cancellationToken).ConfigureAwait(false);
         }
-#endif
 
         /// <summary>
         /// Renames remote file from old path to new path.
@@ -536,8 +530,6 @@ namespace Renci.SshNet
             return InternalListDirectory(path, listCallback);
         }
 
-#if FEATURE_TAP
-
         /// <summary>
         /// Asynchronously retrieves list of files in remote directory.
         /// </summary>
@@ -594,8 +586,6 @@ namespace Renci.SshNet
             return result;
         }
 
-#endif
-
         /// <summary>
         /// Begins an asynchronous operation of retrieving list of files in remote directory.
         /// </summary>
@@ -1129,7 +1119,6 @@ namespace Renci.SshNet
             return _sftpSession.RequestStatVfs(fullPath);
         }
 
-#if FEATURE_TAP
         /// <summary>
         /// Asynchronously gets status using statvfs@openssh.com request.
         /// </summary>
@@ -1154,7 +1143,6 @@ namespace Renci.SshNet
             var fullPath = await _sftpSession.GetCanonicalPathAsync(path, cancellationToken).ConfigureAwait(false);
             return await _sftpSession.RequestStatVfsAsync(fullPath, cancellationToken).ConfigureAwait(false);
         }
-#endif
 
         #region File Methods
 
@@ -1503,7 +1491,6 @@ namespace Renci.SshNet
             return new SftpFileStream(_sftpSession, path, mode, access, (int) _bufferSize);
         }
 
-#if FEATURE_TAP
         /// <summary>
         /// Asynchronously opens a <see cref="SftpFileStream"/> on the specified path, with the specified mode and access.
         /// </summary>
@@ -1529,7 +1516,6 @@ namespace Renci.SshNet
 
             return SftpFileStream.OpenAsync(_sftpSession, path, mode, access, (int)_bufferSize, cancellationToken);
         }
-#endif
 
         /// <summary>
         /// Opens an existing file for reading.

+ 0 - 18
src/Renci.SshNet/Shell.cs

@@ -129,7 +129,6 @@ namespace Renci.SshNet
 
                     while (_channel.IsOpen)
                     {
-#if FEATURE_STREAM_TAP
                         var readTask = _input.ReadAsync(buffer, 0, buffer.Length);
                         var readWaitHandle = ((IAsyncResult) readTask).AsyncWaitHandle;
 
@@ -139,24 +138,7 @@ namespace Renci.SshNet
                             _channel.SendData(buffer, 0, read);
                             continue;
                         }
-#elif FEATURE_STREAM_APM
-                        var asyncResult = _input.BeginRead(buffer, 0, buffer.Length, result =>
-                            {
-                                //  If input stream is closed and disposed already don't finish reading the stream
-                                if (_input == null)
-                                    return;
 
-                                var read = _input.EndRead(result);
-                                _channel.SendData(buffer, 0, read);
-                            }, null);
-
-                        WaitHandle.WaitAny(new[] { asyncResult.AsyncWaitHandle, _channelClosedWaitHandle });
-
-                        if (asyncResult.IsCompleted)
-                            continue;
-#else
-                        #error Async receive is not implemented.
-#endif
                         break;
                     }
                 }