After upgrading my project to .NET 8.0, the call of the function PutRecordsAsync()
from AWSSDK.Kinesis
(3.7.300.7) results in the following error:
System.Private.CoreLib Value cannot be null. (Parameter 'path1') > System.Collections.ListDictionaryInternal
at System.ArgumentNullException.Throw(String paramName)
at System.IO.Path.Combine(String path1, String path2)
at Amazon.Internal.RegionEndpointProviderV3.GetEndpointJsonSourceStream()
at Amazon.Internal.RegionEndpointProviderV3..ctor()
at Amazon.RegionEndpoint.get_RegionEndpointProvider()
at Amazon.RegionEndpoint.get_InternedRegionEndpoint()
at Amazon.RegionEndpoint.GetEndpointForService(String serviceName, GetEndpointForServiceOptions options)
at Amazon.Runtime.Internal.Auth.AWS4Signer.DetermineSigningRegion(IClientConfig clientConfig, String serviceName, RegionEndpoint alternateEndpoint, IRequest request)
at Amazon.Runtime.Internal.Auth.AWS4Signer.SignRequest(IRequest request, IClientConfig clientConfig, RequestMetrics metrics, String awsAccessKeyId, String awsSecretAccessKey)
at Amazon.Runtime.Internal.Auth.AWS4Signer.Sign(IRequest request, IClientConfig clientConfig, RequestMetrics metrics, String awsAccessKeyId, String awsSecretAccessKey)
at Amazon.Runtime.Internal.Auth.AWS4Signer.Sign(IRequest request, IClientConfig clientConfig, RequestMetrics metrics, ImmutableCredentials credentials)
at Amazon.Runtime.Internal.Auth.AbstractAWSSigner.SignAsync(IRequest request, IClientConfig clientConfig, RequestMetrics metrics, ImmutableCredentials credentials, CancellationToken token)
at Amazon.Runtime.Internal.Signer.SignRequestAsync(IRequestContext requestContext)
at Amazon.Runtime.Internal.Signer.PreInvokeAsync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.Signer.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.CredentialsRetriever.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.MetricsHandler.InvokeAsync[T](IExecutionContext executionContext)
at .SendeDataToKinesis(String streamName, Int32 bufferSize)
Code:
var putRecordsResponse = await _kinesisClient.PutRecordsAsync(putRecordsRequest);
What I already checked:
- putRecordsRequest is not null and filled with valid values
- _kinesisClient is correctly initialized with credentials & configuration
With .NET 7 everything (same code, no changes) worked as expected. Does the AWS SDK support .NET 8.0 at the moment? As stated on nuget, .NET 8.0 should be supported.
https://www.nuget.org/packages/AWSSDK.Kinesis -> .NET 8.0 .NET Core 3.1 .NET Standard 2.0 .NET Framework 3.5
What is happening, is that your application tries to load the file
endpoints.json
, which can be used to override the AWS endpoint URLs.Previous versions of the SDK used
Assembly.Location
to calculate the path to this file, but it doesn't work with Native AOT.It looks like it's been fixed here (which was supposed to come out in Core 3.7.300.7 yesterday), but the fix didn't make it into the 8.0 build of this library.
This code:
compiles to this IL: