Skip to content

Commit 4364203

Browse files
committed
Use predefined preprocessor symbols
1 parent 129dfe0 commit 4364203

File tree

7 files changed

+3
-17
lines changed

7 files changed

+3
-17
lines changed

StandardSocketsHttpHandler.FunctionalTests/HttpClientHandlerTest.SslProtocols.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,11 @@ public void DefaultProtocols_MatchesExpected()
3838
[InlineData(SslProtocols.Tls11 | SslProtocols.Tls12)]
3939
[InlineData(SslProtocols.Tls | SslProtocols.Tls12)]
4040
[InlineData(SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12)]
41-
#if !netstandard
4241
[InlineData(Tls13Protocol)]
4342
[InlineData(SslProtocols.Tls11 | Tls13Protocol)]
4443
[InlineData(SslProtocols.Tls12 | Tls13Protocol)]
4544
[InlineData(SslProtocols.Tls | Tls13Protocol)]
4645
[InlineData(SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12 | Tls13Protocol)]
47-
#endif
4846
public void SetGetProtocols_Roundtrips(SslProtocols protocols)
4947
{
5048
using (StandardSocketsHttpHandler handler = CreateSocketsHttpHandler())
@@ -102,14 +100,12 @@ public static IEnumerable<object[]> GetAsync_AllowedSSLVersion_Succeeds_MemberDa
102100
yield return new object[] { SslProtocols.Ssl2, true };
103101
}
104102
#pragma warning restore 0618
105-
#if !netstandard
106103
// These protocols are new, and might not be enabled everywhere yet
107104
if (PlatformDetection.IsUbuntu1810OrHigher)
108105
{
109106
yield return new object[] { Tls13Protocol, false };
110107
yield return new object[] { Tls13Protocol, true };
111108
}
112-
#endif
113109
}
114110

115111
[OuterLoop] // TODO: Issue #11345

StandardSocketsHttpHandler.FunctionalTests/StandardSocketsHttpHandler.FunctionalTests.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
<DefineConstants>TargetsWindows</DefineConstants>
77
</PropertyGroup>
88

9-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net472' ">
10-
<DefineConstants>TargetsWindows;NET472</DefineConstants>
11-
</PropertyGroup>
12-
139
<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
1410
<Compile Remove="TestUtilities\PlatformDetection.NetFx.cs" />
1511
</ItemGroup>

StandardSocketsHttpHandler/Net/Http/SocketsHttpHandler/CancellationHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal static bool ShouldWrapInOperationCanceledException(Exception exception,
2525
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that triggered the cancellation.</param>
2626
/// <returns>The cancellation exception.</returns>
2727
internal static Exception CreateOperationCanceledException(Exception innerException, CancellationToken cancellationToken) =>
28-
#if NETSTANDARD20
28+
#if NETSTANDARD2_0
2929
new TaskCanceledException(s_cancellationMessage, innerException); // TCE for compatibility with other handlers that use TaskCompletionSource.TrySetCanceled()
3030
#else
3131
new TaskCanceledException(s_cancellationMessage, innerException, cancellationToken); // TCE for compatibility with other handlers that use TaskCompletionSource.TrySetCanceled()

StandardSocketsHttpHandler/Net/Http/SocketsHttpHandler/HttpConnection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ private Task FlushAsync()
11671167
private Task WriteToStreamAsync(ReadOnlyMemory<byte> source)
11681168
{
11691169
if (NetEventSource.IsEnabled) Trace($"Writing {source.Length} bytes.");
1170-
#if NETSTANDARD20
1170+
#if NETSTANDARD2_0
11711171
return _stream.WriteAsync(source);
11721172
#else
11731173
return _stream.WriteAsync(source).AsTask();

StandardSocketsHttpHandler/Net/Http/SocketsHttpHandler/RedirectHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ private Uri GetUriForRedirect(Uri requestUri, HttpResponseMessage response)
108108
string redirectFragment = location.Fragment;
109109
if (string.IsNullOrEmpty(redirectFragment))
110110
{
111-
#if NETSTANDARD20
111+
#if NETSTANDARD2_0
112112
// .NET Framework 4.7.2 / 4.8 UriBuilder will always append the fragment marker ('#') to fragment starting with '#',
113113
// while .NET Core will only append the fragment marker if not already present.
114114
if (requestFragment.StartsWith("#"))

StandardSocketsHttpHandler/Net/SecurityProtocol.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ namespace System.Net
99
internal static class SecurityProtocol
1010
{
1111
public const SslProtocols DefaultSecurityProtocols =
12-
#if !netstandard && !netfx
1312
// SP_PROT_TLS1_3 / SslProtocols.Tls13 in netcoreapp3.0
1413
((SslProtocols)12288) |
15-
#endif
1614
SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12;
1715

1816
public const SslProtocols SystemDefaultSecurityProtocols = SslProtocols.None;

StandardSocketsHttpHandler/StandardSocketsHttpHandler.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
<RepositoryUrl>https://github.com/TalAloni/StandardSocketsHttpHandler</RepositoryUrl>
1414
</PropertyGroup>
1515

16-
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
17-
<DefineConstants>NETSTANDARD20</DefineConstants>
18-
</PropertyGroup>
19-
2016
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
2117
<Compile Remove="HashCode.cs" />
2218
<Compile Remove="IO\Extensions\StreamExtensions.cs" />

0 commit comments

Comments
 (0)