diff --git a/CHANGELOG.md b/CHANGELOG.md index a87eb821..2b78de45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.9.9] - 2024-07-11 + +- Fix enum deserialization for SendPrimitiveAsync and + ## [1.9.8] - 2024-07-08 - Migrated source of various libraries to mono repository at . diff --git a/Directory.Build.props b/Directory.Build.props index 3b877d41..595e01aa 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - 1.9.8 + 1.9.9 false diff --git a/src/abstractions/IRequestAdapter.cs b/src/abstractions/IRequestAdapter.cs index 0f6cfe21..47130626 100644 --- a/src/abstractions/IRequestAdapter.cs +++ b/src/abstractions/IRequestAdapter.cs @@ -50,11 +50,7 @@ public interface IRequestAdapter /// The error factories mapping to use in case of a failed request. /// The to use for cancelling the requests. /// The deserialized primitive response model. -#if NET5_0_OR_GREATER - Task SendPrimitiveAsync<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] ModelType>(RequestInformation requestInfo, Dictionary>? errorMapping = default, CancellationToken cancellationToken = default); -#else Task SendPrimitiveAsync(RequestInformation requestInfo, Dictionary>? errorMapping = default, CancellationToken cancellationToken = default); -#endif /// /// Executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model collection. /// @@ -62,11 +58,7 @@ public interface IRequestAdapter /// The error factories mapping to use in case of a failed request. /// The to use for cancelling the requests. /// The deserialized primitive response model collection. -#if NET5_0_OR_GREATER - Task?> SendPrimitiveCollectionAsync<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] ModelType>(RequestInformation requestInfo, Dictionary>? errorMapping = default, CancellationToken cancellationToken = default); -#else Task?> SendPrimitiveCollectionAsync(RequestInformation requestInfo, Dictionary>? errorMapping = default, CancellationToken cancellationToken = default); -#endif /// /// Executes the HTTP request specified by the given RequestInformation with no return content. /// diff --git a/src/http/httpClient/HttpClientRequestAdapter.cs b/src/http/httpClient/HttpClientRequestAdapter.cs index fd203a82..c49feaac 100644 --- a/src/http/httpClient/HttpClientRequestAdapter.cs +++ b/src/http/httpClient/HttpClientRequestAdapter.cs @@ -124,11 +124,7 @@ public string? BaseUrl /// The error factories mapping to use in case of a failed request. /// The to use for cancelling the request. /// The deserialized primitive response model collection. -#if NET5_0_OR_GREATER - public async Task?> SendPrimitiveCollectionAsync<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] ModelType>(RequestInformation requestInfo, Dictionary>? errorMapping = default, CancellationToken cancellationToken = default) -#else public async Task?> SendPrimitiveCollectionAsync(RequestInformation requestInfo, Dictionary>? errorMapping = default, CancellationToken cancellationToken = default) -#endif { using var span = startTracingSpan(requestInfo, nameof(SendPrimitiveCollectionAsync)); var response = await GetHttpResponseMessage(requestInfo, cancellationToken, span).ConfigureAwait(false); @@ -209,11 +205,7 @@ public string? BaseUrl /// The error factories mapping to use in case of a failed request. /// The to use for cancelling the request. /// The deserialized primitive response model. -#if NET5_0_OR_GREATER - public async Task SendPrimitiveAsync<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] ModelType>(RequestInformation requestInfo, Dictionary>? errorMapping = default, CancellationToken cancellationToken = default) -#else public async Task SendPrimitiveAsync(RequestInformation requestInfo, Dictionary>? errorMapping = default, CancellationToken cancellationToken = default) -#endif { using var span = startTracingSpan(requestInfo, nameof(SendPrimitiveAsync)); var modelType = typeof(ModelType); diff --git a/tests/http/httpClient/RequestAdapterTests.cs b/tests/http/httpClient/RequestAdapterTests.cs index 3b468841..1971f062 100644 --- a/tests/http/httpClient/RequestAdapterTests.cs +++ b/tests/http/httpClient/RequestAdapterTests.cs @@ -537,7 +537,6 @@ public async Task ThrowsApiExceptionOnMissingMapping(HttpStatusCode statusCode) } } [Fact] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Trimming", "IL2066:The generic parameter of type or method has a DynamicallyAccessedMembersAttribute, but the value used for it can not be statically analyzed.", Justification = "")] public async Task SendPrimitiveHandleEnumIfValueIsString() { var mockHandler = new Mock(); @@ -570,7 +569,6 @@ public async Task SendPrimitiveHandleEnumIfValueIsString() } [Fact] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Trimming", "IL2066:The generic parameter of type or method has a DynamicallyAccessedMembersAttribute, but the value used for it can not be statically analyzed.", Justification = "")] public async Task SendPrimitiveHandleEnumIfValueIsInteger() { var mockHandler = new Mock(); @@ -603,7 +601,6 @@ public async Task SendPrimitiveHandleEnumIfValueIsInteger() } [Fact] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Trimming", "IL2066:The generic parameter of type or method has a DynamicallyAccessedMembersAttribute, but the value used for it can not be statically analyzed.", Justification = "")] public async Task SendPrimitiveHandleEnumIfValueIsFromEnumMember() { var mockHandler = new Mock(); @@ -636,7 +633,6 @@ public async Task SendPrimitiveHandleEnumIfValueIsFromEnumMember() } [Fact] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Trimming", "IL2066:The generic parameter of type or method has a DynamicallyAccessedMembersAttribute, but the value used for it can not be statically analyzed.", Justification = "")] public async Task SendPrimitiveReturnsNullIfValueCannotBeParsedToEnum() { var mockHandler = new Mock(); @@ -669,7 +665,6 @@ public async Task SendPrimitiveReturnsNullIfValueCannotBeParsedToEnum() } [Fact] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Trimming", "IL2066:The generic parameter of type or method has a DynamicallyAccessedMembersAttribute, but the value used for it can not be statically analyzed.", Justification = "")] public async Task SendPrimitiveHandleEnumFlagsIfValuesAreStrings() { var mockHandler = new Mock(); @@ -702,7 +697,6 @@ public async Task SendPrimitiveHandleEnumFlagsIfValuesAreStrings() } [Fact] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Trimming", "IL2066:The generic parameter of type or method has a DynamicallyAccessedMembersAttribute, but the value used for it can not be statically analyzed.", Justification = "")] public async Task SendPrimitiveHandleEnumFlagsIfValuesAreIntegers() { var mockHandler = new Mock(); @@ -735,7 +729,6 @@ public async Task SendPrimitiveHandleEnumFlagsIfValuesAreIntegers() } [Fact] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Trimming", "IL2066:The generic parameter of type or method has a DynamicallyAccessedMembersAttribute, but the value used for it can not be statically analyzed.", Justification = "")] public async Task SendPrimitiveHandleEnumFlagsIfValuesAreFromEnumMember() { var mockHandler = new Mock(); @@ -768,7 +761,6 @@ public async Task SendPrimitiveHandleEnumFlagsIfValuesAreFromEnumMember() } [Fact] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Trimming", "IL2066:The generic parameter of type or method has a DynamicallyAccessedMembersAttribute, but the value used for it can not be statically analyzed.", Justification = "")] public async Task SendPrimitiveReturnsNullIfFlagValueCannotBeParsedToEnum() { var mockHandler = new Mock();