Skip to content

Commit e661de2

Browse files
committed
Remove AWS_ASYNC_API define and code not meeting AWS_ASYNC_API criteria.
1 parent 11a12a6 commit e661de2

File tree

129 files changed

+38
-568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+38
-568
lines changed

extensions/src/AWSSDK.Extensions.CloudFront.Signers/AWSSDK.Extensions.CloudFront.Signers.NetStandard.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net8.0</TargetFrameworks>
44
<AssemblyName>AWSSDK.Extensions.CloudFront.Signers</AssemblyName>
55
<PackageId>AWSSDK.Extensions.CloudFront.Signers</PackageId>
6-
<DefineConstants>$(DefineConstants);NETSTANDARD;AWS_ASYNC_API</DefineConstants>
6+
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
77
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
88
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
99
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>

generator/ServiceModels/_manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"name": "NetFramework",
55
"targetFrameworks": [ "net472" ],
6-
"defineConstants": [ "BCL", "AWS_ASYNC_API", "CODE_ANALYSIS" ],
6+
"defineConstants": [ "BCL", "CODE_ANALYSIS" ],
77
"template": "VS2017ProjectFile",
88
"excludeFolders": [ "_netstandard", "obj"],
99
"nugetTargetPlatform": "net472",
@@ -28,7 +28,7 @@
2828
{
2929
"name": "NetStandard",
3030
"targetFrameworks": [ "netstandard2.0", "netcoreapp3.1", "net8.0" ],
31-
"defineConstants": [ "NETSTANDARD", "AWS_ASYNC_API"],
31+
"defineConstants": [ "NETSTANDARD"],
3232
"template": "VS2017ProjectFile",
3333
"binSubFolder" : "",
3434
"configurations" : [],
@@ -60,7 +60,7 @@
6060
"Custom\\Runtime\\TestResponses\\*.txt",
6161
"Custom\\Runtime\\EventStreams\\test_vectors\\*",
6262
"Custom\\Runtime\\TestEndpoints\\*.json",
63-
"Custom\\TestTools\\ComparerTest.json",
63+
"Custom\\TestTools\\ComparerTest.json"
6464
],
6565
"packageReferences": [
6666
{

sdk/src/Core/AWSSDK.Core.NetFramework.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<RunAnalyzersDuringBuild Condition="'$(RunAnalyzersDuringBuild)'==''">true</RunAnalyzersDuringBuild>
44
<TargetFramework>net472</TargetFramework>
5-
<DefineConstants>DEBUG;TRACE;BCL;AWS_ASYNC_API;CODE_ANALYSIS</DefineConstants>
5+
<DefineConstants>DEBUG;TRACE;BCL;CODE_ANALYSIS</DefineConstants>
66
<DebugType>portable</DebugType>
77
<GenerateDocumentationFile>true</GenerateDocumentationFile>
88
<AssemblyName>AWSSDK.Core</AssemblyName>

sdk/src/Core/AWSSDK.Core.NetStandard.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<RunAnalyzersDuringBuild Condition="'$(RunAnalyzersDuringBuild)'==''">true</RunAnalyzersDuringBuild>
44
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net8.0</TargetFrameworks>
5-
<DefineConstants>$(DefineConstants);NETSTANDARD;AWS_ASYNC_API</DefineConstants>
5+
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
66
<DefineConstants Condition="'$(TargetFramework)' == 'netstandard2.0'">$(DefineConstants);NETSTANDARD20;AWS_ASYNC_ENUMERABLES_API</DefineConstants>
77
<DefineConstants Condition="'$(TargetFramework)' == 'netcoreapp3.1'">$(DefineConstants);AWS_ASYNC_ENUMERABLES_API</DefineConstants>
88
<DefineConstants Condition="'$(TargetFramework)' == 'net8.0'">$(DefineConstants);AWS_ASYNC_ENUMERABLES_API</DefineConstants>

sdk/src/Core/Amazon.Runtime/AmazonServiceClient.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,6 @@ protected TResponse Invoke<TResponse>(AmazonWebServiceRequest request, InvokeOpt
219219
return response;
220220
}
221221

222-
#if AWS_ASYNC_API
223-
224222
protected System.Threading.Tasks.Task<TResponse> InvokeAsync<TResponse>(
225223
AmazonWebServiceRequest request,
226224
InvokeOptionsBase options,
@@ -249,7 +247,6 @@ protected System.Threading.Tasks.Task<TResponse> InvokeAsync<TResponse>(
249247
SetupCSMHandler(executionContext.RequestContext);
250248
return this.RuntimePipeline.InvokeAsync<TResponse>(executionContext);
251249
}
252-
#endif
253250

254251
protected virtual IEnumerable<DiscoveryEndpointBase> EndpointOperation(EndpointOperationContextBase context) { return null; }
255252

sdk/src/Core/Amazon.Runtime/CSM/CSMUtilities.cs

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
using System.Text;
2222
using System.Text.RegularExpressions;
2323
using System.IO;
24-
#if AWS_ASYNC_API
2524
using System.Threading.Tasks;
26-
#endif
2725
using System.Text.Json;
2826

2927
namespace Amazon.Runtime.Internal
@@ -35,7 +33,7 @@ namespace Amazon.Runtime.Internal
3533
public static class CSMUtilities
3634
{
3735
private const string requestKey = "Request";
38-
#if AWS_ASYNC_API
36+
3937
public static Task SerializetoJsonAndPostOverUDPAsync(MonitoringAPICall monitoringAPICall)
4038
{
4139
var monitoringAPICallAttempt = monitoringAPICall as MonitoringAPICallAttempt;
@@ -55,27 +53,7 @@ public static Task SerializetoJsonAndPostOverUDPAsync(MonitoringAPICall monitori
5553
}
5654
return Task.FromResult(0);
5755
}
58-
#else
59-
public static void BeginSerializetoJsonAndPostOverUDP(MonitoringAPICall monitoringAPICall)
60-
{
61-
string response = string.Empty;
62-
var monitoringAPICallAttempt = monitoringAPICall as MonitoringAPICallAttempt;
63-
if (monitoringAPICallAttempt != null)
64-
{
65-
if (CreateUDPMessage(monitoringAPICallAttempt, out response))
66-
{
67-
MonitoringListener.Instance.BeginPostMessagesOverUDPInvoke(response);
68-
}
69-
}
70-
else
71-
{
72-
if (CreateUDPMessage((MonitoringAPICallEvent)monitoringAPICall, out response))
73-
{
74-
MonitoringListener.Instance.BeginPostMessagesOverUDPInvoke(response);
75-
}
76-
}
77-
}
78-
#endif
56+
7957
public static void SerializetoJsonAndPostOverUDP(MonitoringAPICall monitoringAPICall)
8058
{
8159
string response = string.Empty;

sdk/src/Core/Amazon.Runtime/CSM/MonitoringListener.cs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
using System.Net;
1818
using System.Net.Sockets;
1919
using System.Text;
20-
#if AWS_ASYNC_API
2120
using System.Threading.Tasks;
22-
#endif
2321
using Amazon.Runtime.Internal;
2422
using Amazon.Runtime.Internal.Util;
2523

@@ -82,7 +80,6 @@ public void PostMessagesOverUDP(string response)
8280
/// <summary>
8381
/// Method to post UDP datagram for async calls
8482
/// </summary>
85-
#if AWS_ASYNC_API
8683
public async Task PostMessagesOverUDPAsync(string response)
8784
{
8885
try
@@ -97,42 +94,6 @@ await _udpClient.SendAsync(Encoding.UTF8.GetBytes(response),
9794
}
9895
}
9996

100-
/// <summary>
101-
/// Method to post UDP datagram for bcl35 async calls
102-
/// </summary>
103-
#else
104-
public void BeginPostMessagesOverUDPInvoke(string response)
105-
{
106-
try
107-
{
108-
_udpClient.BeginSend(Encoding.UTF8.GetBytes(response),
109-
Encoding.UTF8.GetBytes(response).Length, _host, _port, new AsyncCallback(EndSendMessagesOverUDPInvoke), _udpClient);
110-
}
111-
catch (Exception e)
112-
{
113-
// If UDP post fails, the errors is logged and is returned without rethrowing the exception
114-
logger.InfoFormat("Error when posting UDP datagrams. " + e.Message);
115-
}
116-
}
117-
118-
private void EndSendMessagesOverUDPInvoke(IAsyncResult ar)
119-
{
120-
try
121-
{
122-
var udpClient = (UdpClient)ar.AsyncState;
123-
if (!ar.IsCompleted)
124-
{
125-
ar.AsyncWaitHandle.WaitOne();
126-
}
127-
udpClient.EndSend(ar);
128-
}
129-
catch (Exception e)
130-
{
131-
// If UDP post fails, the errors is logged and is returned without rethrowing the exception
132-
logger.InfoFormat("Error when posting UDP datagrams. " + e.Message);
133-
}
134-
}
135-
#endif
13697
private bool _disposed;
13798
public void Dispose()
13899
{

sdk/src/Core/Amazon.Runtime/Credentials/DefaultInstanceProfileAWSCredentials.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
using System;
1919
using System.Globalization;
2020
using System.Threading;
21-
#if AWS_ASYNC_API
2221
using System.Threading.Tasks;
23-
#endif
2422

2523
namespace Amazon.Runtime
2624
{

sdk/src/Core/Amazon.Runtime/Credentials/Internal/_bcl+netstandard/SSOTokenFileCache.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@
1818
using System.IO;
1919
using System.Text;
2020
using Amazon.Runtime.CredentialManagement;
21-
#if AWS_ASYNC_API
2221
using System.Threading;
2322
using System.Threading.Tasks;
24-
#endif
2523
using Amazon.Runtime.Internal.Util;
2624
using Amazon.Util;
2725
using Amazon.Util.Internal;
@@ -45,8 +43,6 @@ public interface ISSOTokenFileCache
4543
/// <inheritdoc cref="ScanSsoTokensAsync"/>
4644
List<SSOTokenFile> ScanSsoTokens(string ssoCacheDirectory);
4745

48-
49-
#if AWS_ASYNC_API
5046
/// <summary>
5147
/// Tries to load a <see cref="SsoToken"/> from the SSO File Cache.
5248
/// </summary>
@@ -86,7 +82,6 @@ public interface ISSOTokenFileCache
8682
/// Cancels the operation
8783
/// </param>
8884
Task<List<SSOTokenFile>> ScanSsoTokensAsync(string ssoCacheDirectory, CancellationToken cancellationToken = default);
89-
#endif
9085
}
9186

9287
[SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Try methods intentionally suppress all Exceptions")]

sdk/src/Core/Amazon.Runtime/Credentials/Internal/_bcl+netstandard/SSOTokenManager.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ public interface ISSOTokenManager
3535

3636
#endif
3737

38-
#if AWS_ASYNC_API
3938
Task<SsoToken> GetTokenAsync(SSOTokenManagerGetTokenOptions options, CancellationToken cancellationToken = default);
4039
Task LogoutAsync(string ssoCacheDirectory = null, CancellationToken cancellationToken = default);
4140
Task LogoutAsync(SSOTokenManagerGetTokenOptions options, CancellationToken cancellationToken = default);
42-
#endif
4341
}
4442
public class SSOTokenManager : ISSOTokenManager
4543
{
@@ -107,8 +105,6 @@ private static string BuildCacheKey(SSOTokenManagerGetTokenOptions options)
107105
}
108106
}
109107

110-
#if BCL || AWS_ASYNC_API
111-
112108
private class RefreshState
113109
{
114110
public bool FailedLastRefreshAttempt { get; set; }
@@ -128,7 +124,6 @@ private class CacheState
128124
public SsoToken Token { get; set; }
129125
public RefreshState RefreshState { get; set; }
130126
}
131-
#endif
132127

133128
#if BCL
134129
public SsoToken GetToken(SSOTokenManagerGetTokenOptions options)
@@ -387,7 +382,6 @@ private SsoToken GenerateNewToken(SSOTokenManagerGetTokenOptions options)
387382

388383
#endif
389384

390-
#if AWS_ASYNC_API
391385
public async Task<SsoToken> GetTokenAsync(SSOTokenManagerGetTokenOptions options, CancellationToken cancellationToken = default)
392386
{
393387
CacheState inMemoryToken = null;
@@ -681,7 +675,6 @@ private static List<string> GetEmptySSOTokenOptions(SSOTokenManagerGetTokenOptio
681675

682676
return emptyProperties;
683677
}
684-
#endif
685678

686679
private static SsoToken MapGetSsoTokenResponseToSsoToken(GetSsoTokenResponse response, string session)
687680
{

0 commit comments

Comments
 (0)