amazon-archives / aws-sdk-xamarin

AWS Mobile SDK for Xamarin (Beta)
Apache License 2.0
45 stars 18 forks source link

SNS: NotImplementedException calling CreatePlatformEndpointAsync #5

Closed hlogmans closed 10 years ago

hlogmans commented 10 years ago

I get this exception:

System.NotImplementedException: The requested feature is not implemented.
  at Amazon.Runtime.Internal.Marshaller.PreInvoke (IExecutionContext executionContext) [0x00000] in /Users/hlogmans/development/aws-sdk-xamarin/AWS.XamarinSDK/AWSSDK_Core/Amazon.Runtime/Pipeline/Handlers/Marshaller.cs:35 
  at Amazon.Runtime.Internal.GenericHandler+<InvokeAsync>c__async0`1[Amazon.SimpleNotificationService.Model.CreatePlatformEndpointResponse].MoveNext () [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:62 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[Amazon.SimpleNotificationService.Model.CreatePlatformEndpointResponse
].GetResult () [0x00000] in <filename unknown>:0 
  at Amazon.Runtime.Internal.GenericHandler+<InvokeAsync>c__async0`1[Amazon.SimpleNotificationService.Model.CreatePlatformEndpointResponse].MoveNext () [0x00000] in <filename unknown>:0 

This exception is generated from the aws-sdk-xamarin code. Looks like the Marshall class needs to be overriden, but that is not initialized.

This is the code I try to use (Xamarin 8.4 iOS)

            var request = new CreatePlatformEndpointRequest()
            {
                Token = tokendata,
                PlatformApplicationArn = "arn:aws:sns:us-east-1:****restofmyarn****x"
            };

            using (var aclient = new AmazonSimpleNotificationServiceClient("A***********A", "rYO*****************LlqxI", RegionEndpoint.USEast1))
            {
                var task = aclient.CreatePlatformEndpointAsync(request);
                task.ContinueWith((x) =>
                {
                    if (x.IsFaulted)
                    {
                        InvokeOnMainThread(() =>
                        {
                            Console.WriteLine(task.Exception.Flatten().ToString());
                        });

                    }
                });

            }

Am I doing something wrong?

tawalke commented 10 years ago

Are you using the PCL version when you get this exception?

"There are seven sins in the world: wealth without work, pleasure without conscience, knowledge without character, commerce without morality, science without humanity, worship without sacrifice, and politics without principle."

~Mahatma Gandhi

From: hlogmans [mailto:notifications@github.com] Sent: Thursday, October 23, 2014 9:36 AM To: awslabs/aws-sdk-xamarin Subject: [aws-sdk-xamarin] SNS: NotImplementedException calling CreatePlatformEndpointAsync (#5)

I get this exception:

System.NotImplementedException: The requested feature is not implemented. at Amazon.Runtime.Internal.Marshaller.PreInvoke (IExecutionContext executionContext) [0x00000] in /Users/hlogmans/development/aws-sdk-xamarin/AWS.XamarinSDK/AWSSDK_Core/Amazon.Runtime/Pipeline/Handlers/Marshaller.cs:35 at Amazon.Runtime.Internal.GenericHandler+casync01[Amazon.SimpleNotificationService.Model.CreatePlatformEndpointResponse].MoveNext () [0x00000] in <filename unknown>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:62 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[Amazon.SimpleNotificationService.Model.CreatePlatformEndpointResponse ].GetResult () [0x00000] in :0 at Amazon.Runtime.Internal.GenericHandler+casync0`1[Amazon.SimpleNotificationService.Model.CreatePlatformEndpointResponse].MoveNext () [0x00000] in :0

This exception is generated from the aws-sdk-xamarin code. Looks like the Marshall class needs to be overriden, but that is not initialized.

This is the code I try to use (Xamarin 8.4 iOS)

        var request = new CreatePlatformEndpointRequest()
        {
            Token = tokendata,
            PlatformApplicationArn = "arn:aws:sns:us-east-1:****restofmyarn****x"
        };

        using (var aclient = new AmazonSimpleNotificationServiceClient("A***********A", "rYO*****************LlqxI", RegionEndpoint.USEast1))
        {
            var task = aclient.CreatePlatformEndpointAsync(request);
            task.ContinueWith((x) =>
            {
                if (x.IsFaulted)
                {
                    InvokeOnMainThread(() =>
                    {
                        Console.WriteLine(task.Exception.Flatten().ToString());
                    });

                }
            });

        }

Am I doing something wrong?

— Reply to this email directly or view it on GitHub https://github.com/awslabs/aws-sdk-xamarin/issues/5 . https://github.com/notifications/beacon/ACMW1nqboQ6RhiDvs_BhPpfCR60OJ9aOks5nGPuugaJpZM4CyKxc.gif

hlogmans commented 10 years ago

Yup, seemed I used the dll from the Core folder. Now changed to the dll's in the iOS folder.

That helped. Thanks