-
Notifications
You must be signed in to change notification settings - Fork 866
Description
Describe the bug
After update from AWSSDK.S3 3.7.413.4 to 4.0.6.10.
When call GetLifecycleConfigurationAsync there is an error: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
Stack trace:
at System.ThrowHelper.ThrowArgumentOutOfRange_IndexMustBeLessException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at Amazon.S3.Model.Internal.MarshallTransformations.LifecycleRuleUnmarshaller.Unmarshall(XmlUnmarshallerContext context)
at Amazon.S3.Model.Internal.MarshallTransformations.LifecycleConfigurationUnmarshaller.Unmarshall(XmlUnmarshallerContext context)
at Amazon.S3.Model.Internal.MarshallTransformations.GetLifecycleConfigurationResponseUnmarshaller.UnmarshallResult(XmlUnmarshallerContext context, GetLifecycleConfigurationResponse response)
at Amazon.S3.Model.Internal.MarshallTransformations.GetLifecycleConfigurationResponseUnmarshaller.Unmarshall(XmlUnmarshallerContext context)
at Amazon.Runtime.Internal.Transform.XmlResponseUnmarshaller.Unmarshall(UnmarshallerContext input)
at Amazon.S3.Model.Internal.MarshallTransformations.S3ReponseUnmarshaller.Unmarshall(UnmarshallerContext input)
at Amazon.Runtime.Internal.Transform.ResponseUnmarshaller.UnmarshallResponse(UnmarshallerContext context)
at Amazon.Runtime.Internal.Unmarshaller.UnmarshallResponse(UnmarshallerContext context, IRequestContext requestContext)
at Amazon.Runtime.Internal.Unmarshaller.<UnmarshallAsync>d__5.MoveNext()
at Amazon.Runtime.Internal.Unmarshaller.<InvokeAsync>d__3`1.MoveNext()
at Amazon.S3.Internal.AmazonS3ResponseHandler.<InvokeAsync>d__1`1.MoveNext()
at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__5`1.MoveNext()
at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__5`1.MoveNext()
at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1.MoveNext()
at Amazon.Runtime.Internal.Signer.<InvokeAsync>d__1`1.MoveNext()
at Amazon.S3.Internal.S3Express.S3ExpressPreSigner.<InvokeAsync>d__5`1.MoveNext()
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.<InvokeAsync>d__2`1.MoveNext()
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.<InvokeAsync>d__2`1.MoveNext()
at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10`1.MoveNext()
at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10`1.MoveNext()
at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1.MoveNext()
at Amazon.Runtime.Internal.BaseAuthResolverHandler.<InvokeAsync>d__2`1.MoveNext()
at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1.MoveNext()
at Amazon.S3.Internal.AmazonS3ExceptionHandler.<InvokeAsync>d__1`1.MoveNext()
at Amazon.Runtime.Internal.ErrorCallbackHandler.<InvokeAsync>d__5`1.MoveNext()
at Amazon.Runtime.Internal.MetricsHandler.<InvokeAsync>d__1`1.MoveNext()
at CMAAWSHelpers.S3Client.<GetLifecycleRulesAsync>d__12.MoveNext() in D:\...\...\...\S3Client.cs:line 314
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
No such error, as everything worked on SDK version3.7.413.4
Current Behavior
exception is thrown ONLY if there is lifecycle rules for S3 bucket. If there is no lifecyle rules - no exception, it just returns NoSuchLifecycleConfiguration with HTTP Status Code: 404 Not Found.
Reproduction Steps
var bucketName = "name_of_your_s3_bucket";
var request = new GetLifecycleConfigurationRequest {
BucketName = bucketName
};
var result = await _client.GetLifecycleConfigurationAsync(request);
//var result = await _client.GetLifecycleConfigurationAsync(bucketName); //the same
Possible Solution
not clear, as an exception is pretty common. But the problem may be in creating/parsing a response(because for S3 bucket without lifecycle rules, everything works correct).
Additional Information/Context
The S3 bucket should have at least 1 lifecycle rule. In my case, it was the simplest expiration rule for 30/60 days(checked on 2 different S3 buckets, result is the same).
AWS .NET SDK and/or Package version used
AWSSDK.S3 4.0.6.10
Targeted .NET Platform
net8.0
Operating System and version
Windows 11