Skip to content

Commit 4c3c3ce

Browse files
authored
Merge pull request #995 from dcabib/chore/deprecate-net6
chore: drop .NET 6 support, go .NET 8 only
2 parents 1dfab3c + 863e13b commit 4c3c3ce

File tree

49 files changed

+22
-312
lines changed

Some content is hidden

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

49 files changed

+22
-312
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # 5.0.0
2828
with:
2929
dotnet-version: |
30-
6.0.x
3130
8.0.x
3231
3332
- name: Install dependencies

.github/workflows/examples-tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # 5.0.0
2828
with:
2929
dotnet-version: |
30-
6.0.x
3130
8.0.x
3231
3332
- name: Install dependencies

.github/workflows/publish-artifacts-examples-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ jobs:
3333
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # 5.0.0
3434
with:
3535
dotnet-version: |
36-
6.0.x
3736
8.0.x
3837
3938
- name: Build libraries
@@ -64,7 +63,6 @@ jobs:
6463
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # 5.0.0
6564
with:
6665
dotnet-version: |
67-
6.0.x
6866
8.0.x
6967
7068
- name: Download packages
@@ -124,7 +122,6 @@ jobs:
124122
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # 5.0.0
125123
with:
126124
dotnet-version: |
127-
6.0.x
128125
8.0.x
129126
130127
- name: Setup GitHub Packages source

libraries/src/AWS.Lambda.Powertools.Idempotency/Idempotency.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,8 @@ public IdempotencyBuilder WithOptions(IdempotencyOptions options)
166166
return this;
167167
}
168168

169-
#if NET8_0_OR_GREATER
170169
/// <summary>
171-
/// Set Customer JsonSerializerContext to append to IdempotencySerializationContext
170+
/// Set Customer JsonSerializerContext to append to IdempotencySerializationContext
172171
/// </summary>
173172
/// <param name="context"></param>
174173
/// <returns>IdempotencyBuilder</returns>
@@ -177,6 +176,5 @@ public IdempotencyBuilder WithJsonSerializationContext(JsonSerializerContext con
177176
IdempotencySerializer.AddTypeInfoResolver(context);
178177
return this;
179178
}
180-
#endif
181179
}
182180
}

libraries/src/AWS.Lambda.Powertools.Idempotency/IdempotencyOptionsBuilder.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class IdempotencyOptionsBuilder
4040
/// <summary>
4141
/// Default Hash function
4242
/// </summary>
43-
private string _hashFunction = "MD5";
43+
private readonly string _hashFunction = "MD5";
4444

4545
/// <summary>
4646
/// Response hook function
@@ -160,15 +160,9 @@ public IdempotencyOptionsBuilder WithExpiration(TimeSpan duration)
160160
/// </summary>
161161
/// <param name="hashFunction">Can be any algorithm supported by HashAlgorithm.Create</param>
162162
/// <returns>the instance of the builder (to chain operations)</returns>
163-
#if NET8_0_OR_GREATER
164163
[Obsolete("Idempotency uses MD5 and does not support other hash algorithms.")]
165-
#endif
166164
public IdempotencyOptionsBuilder WithHashFunction(string hashFunction)
167165
{
168-
#if NET6_0
169-
// for backward compability keep this code in .net 6
170-
_hashFunction = hashFunction;
171-
#endif
172166
return this;
173167
}
174168

libraries/src/AWS.Lambda.Powertools.Idempotency/Internal/Serializers/IdempotencySerializationContext.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@
1717

1818
namespace AWS.Lambda.Powertools.Idempotency.Internal.Serializers;
1919

20-
#if NET8_0_OR_GREATER
21-
22-
2320
/// <summary>
24-
/// The source generated JsonSerializerContext to be used to Serialize Idempotency types
21+
/// The source generated JsonSerializerContext to be used to Serialize Idempotency types
2522
/// </summary>
2623
[JsonSerializable(typeof(string))]
2724
[JsonSerializable(typeof(object))]
2825
public partial class IdempotencySerializationContext : JsonSerializerContext
2926
{
3027

31-
}
32-
#endif
28+
}

libraries/src/AWS.Lambda.Powertools.Idempotency/Internal/Serializers/IdempotencySerializer.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,12 @@ private static void BuildDefaultOptions()
2929
{
3030
PropertyNameCaseInsensitive = true
3131
};
32-
#if NET8_0_OR_GREATER
3332
if (!RuntimeFeatureWrapper.IsDynamicCodeSupported)
3433
{
3534
_jsonOptions.TypeInfoResolverChain.Add(IdempotencySerializationContext.Default);
3635
}
37-
#endif
3836
}
3937

40-
#if NET8_0_OR_GREATER
41-
4238
/// <summary>
4339
/// Adds a JsonTypeInfoResolver to the JsonSerializerOptions.
4440
/// </summary>
@@ -73,7 +69,6 @@ internal static void SetJsonOptions(JsonSerializerOptions options)
7369
{
7470
_jsonOptions = options;
7571
}
76-
#endif
7772

7873
/// <summary>
7974
/// Serializes the specified object to a JSON string.
@@ -83,9 +78,6 @@ internal static void SetJsonOptions(JsonSerializerOptions options)
8378
/// <returns>A JSON string representation of the object.</returns>
8479
internal static string Serialize(object value, Type inputType)
8580
{
86-
#if NET6_0
87-
return JsonSerializer.Serialize(value, _jsonOptions);
88-
#else
8981
if (RuntimeFeatureWrapper.IsDynamicCodeSupported)
9082
{
9183
#pragma warning disable
@@ -100,7 +92,6 @@ internal static string Serialize(object value, Type inputType)
10092
}
10193

10294
return JsonSerializer.Serialize(value, typeInfo);
103-
#endif
10495
}
10596

10697
/// <summary>
@@ -113,15 +104,11 @@ internal static string Serialize(object value, Type inputType)
113104
[UnconditionalSuppressMessage("AOT", "IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.", Justification = "False positive")]
114105
internal static T Deserialize<T>(string value)
115106
{
116-
#if NET6_0
117-
return JsonSerializer.Deserialize<T>(value,_jsonOptions);
118-
#else
119107
if (RuntimeFeatureWrapper.IsDynamicCodeSupported)
120108
{
121109
return JsonSerializer.Deserialize<T>(value, _jsonOptions);
122110
}
123111

124112
return (T)JsonSerializer.Deserialize(value, GetTypeInfo(typeof(T)));
125-
#endif
126113
}
127114
}

libraries/src/AWS.Lambda.Powertools.Idempotency/Persistence/BasePersistenceStore.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,8 @@ private static bool IsMissingIdempotencyKey(JsonElement data)
324324
/// <exception cref="ArgumentException"></exception>
325325
internal string GenerateHash(JsonElement data)
326326
{
327-
#if NET8_0_OR_GREATER
328327
// starting .NET 8 no option to change hash algorithm
329328
using var hashAlgorithm = MD5.Create();
330-
#else
331-
using var hashAlgorithm = HashAlgorithm.Create(_idempotencyOptions.HashFunction);
332-
#endif
333329
if (hashAlgorithm == null)
334330
{
335331
throw new ArgumentException("Invalid HashAlgorithm");

libraries/src/AWS.Lambda.Powertools.JMESPath/Serializers/JMESPathSerializationContext.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
namespace AWS.Lambda.Powertools.JMESPath.Serializers;
55

6-
#if NET8_0_OR_GREATER
7-
86
/// <summary>
97
/// The source generated JsonSerializerContext to be used to Serialize JMESPath types
108
/// </summary>
@@ -16,6 +14,4 @@ namespace AWS.Lambda.Powertools.JMESPath.Serializers;
1614
[JsonSerializable(typeof(JsonElement))]
1715
public partial class JmesPathSerializationContext : JsonSerializerContext
1816
{
19-
}
20-
21-
#endif
17+
}

libraries/src/AWS.Lambda.Powertools.JMESPath/Serializers/JMESPathSerializer.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@ internal static class JmesPathSerializer
1616
/// <returns>System.String.</returns>
1717
internal static string Serialize(object value, Type inputType)
1818
{
19-
#if NET6_0
20-
return JsonSerializer.Serialize(value);
21-
#else
22-
2319
return JsonSerializer.Serialize(value, inputType, JmesPathSerializationContext.Default);
24-
#endif
2520
}
2621

2722
/// <summary>
@@ -32,11 +27,6 @@ internal static string Serialize(object value, Type inputType)
3227
/// <returns>T.</returns>
3328
internal static T Deserialize<T>(string value)
3429
{
35-
#if NET6_0
36-
return JsonSerializer.Deserialize<T>(value);
37-
#else
38-
3930
return (T)JsonSerializer.Deserialize(value, typeof(T), JmesPathSerializationContext.Default);
40-
#endif
4131
}
4232
}

0 commit comments

Comments
 (0)