public override IAsyncResult InvokeAsync()

in src/Internal/SetupEncryptionHandler.cs [173:194]


        public override IAsyncResult InvokeAsync(IAsyncExecutionContext executionContext)
        {
            IExecutionContext syncExecutionContext = ExecutionContext.CreateFromAsyncContext(executionContext);

            ThrowIfRangeGet(syncExecutionContext);

            if (NeedToGenerateKMSInstructions(syncExecutionContext))
                throw new NotSupportedException("The AWS SDK for .NET Framework 3.5 version of " +
                    EncryptionClient.GetType().Name + " does not support KMS key wrapping via the async programming model.  " +
                    "Please use the synchronous version instead.");

            var instructions = GenerateInstructions(syncExecutionContext);

            var putObjectRequest = syncExecutionContext.RequestContext.OriginalRequest as PutObjectRequest;
            if (putObjectRequest != null)
            {
                EncryptObject(instructions, putObjectRequest);
            }

            PreInvokeSynchronous(syncExecutionContext, instructions);
            return base.InvokeAsync(executionContext);
        }