Closed jasonmc86 closed 9 years ago
@jasonmc86 Are you implementing this is in the PCL? Correct. The Xamarin SDK uses the Bait and Switch method for implementation http://log.paulbetts.org/the-bait-and-switch-pcl-trick/ in which the implementation will be executed on the specific platform.
@tawalke Yeah in the PCL. Do i need to implement it in the Platform specific projects? Why does the xamarin aws sdk use the bait and switch approach? is not possible to have a shared implementation? Could you demo up some code to show me what i'd need to do instead?
Yes, create an interface in the PCL and implement the actual desired implementation in the platform you want to support.
Reference Paul Betts blog on Bait and Switch if you need more info: http://log.paulbetts.org/the-bait-and-switch-pcl-trick/ It's the best reference for usage of Bait and Switch.
Appreciate your help :+1: I've got a button click event in a xamarin list view, how do i tell xamarin to run the click event handler in each platform (that runs the code above), rather than the button click event I declare in the PCL?
Or rather even tell xamarin to run my an inteface's method in the platform specific code.
I'll play and let you know if I can't get it going. Thanks :p
No worries, let me know how it goes. Another good reference point is: http://visualstudiomagazine.com/articles/2014/02/01/using-portable-class-libraries-in-ios-and-android-apps.aspx
@jasonmc86 Your question about the click event, you use platform abstraction and create an interface that does it which will instantiate based upon the platform. Check out the Visual studio link I pasted above.
@tawalke I got the code to be called from the android project, but just hangs :-1:
using (AmazonCognitoSyncClient client = new AmazonCognitoSyncClient (awsUserCreds.AccessKey, awsUserCreds.SecretKey, awsUserCreds.Token, RegionEndpoint.USEast1)) { var datasets = client.ListDatasetsAsync(new ListDatasetsRequest{
}).Result;
var recordsResult = client.ListRecordsAsync (new ListRecordsRequest {
DatasetName = dataSetName,
}).Result;
var result = client.UpdateRecordsAsync (new UpdateRecordsRequest {
All three just hang. :-1: any ideas?
Hmm, let’s brainstorm here…You have set to correct IAM permissions right?
Sent from Windows Mail
From: jasonmc86 Sent: Saturday, April 18, 2015 5:10 PM To: 'awslabs/aws-sdk-xamarin' Cc: Tara Walker
@tawalke I got the code to be called from the android project, but just hangs :-1:
using (AmazonCognitoSyncClient client = new AmazonCognitoSyncClient (awsUserCreds.AccessKey, awsUserCreds.SecretKey, awsUserCreds.Token, RegionEndpoint.USEast1)) { var datasets = client.ListDatasetsAsync(new ListDatasetsRequest{ }).Result;
var recordsResult = client.ListRecordsAsync (new ListRecordsRequest {
DatasetName = dataSetName,
}).Result;
var result = client.UpdateRecordsAsync (new UpdateRecordsRequest {
All three just hang. :-1: any ideas?
— Reply to this email directly or view it on GitHub.
Yeah my IAM roles are correct if I do similar code call via node js aws SDK works fine
Okay, I will write similar code and see what the issue is and replicate the problem.
Sent from Windows Mail
From: jasonmc86 Sent: Sunday, April 19, 2015 12:12 AM To: 'awslabs/aws-sdk-xamarin' Cc: Tara Walker
Yeah my IAM roles are correct if I do similar code call via node js aws SDK works fine
— Reply to this email directly or view it on GitHub.
@jasonmc86 Were you using the new v4 or previous v3?
I'm using the NuGet Package which i believe is still at 2.1.7 can you please update it... package id="AWS-Mobile-SDK-Xamarin-Beta" version="2.1.7" targetFramework="portable-net45+wp80+MonoAndroid10+xamarinios10+MonoTouch10"
Once all testing is complete with the Xamarin.iOS folders for Unified API it will be updated.
From: jasonmc86mailto:notifications@github.com Sent: 5/15/2015 6:32 PM To: awslabs/aws-sdk-xamarinmailto:aws-sdk-xamarin@noreply.github.com Cc: tawalkemailto:taraew@live.com Subject: Re: [aws-sdk-xamarin] AmazonCognitoSyncClient - UpdateRecordsAsync - Unhandled Exception - The requested feature is not implemented (#21)
I'm using the NuGet Package which i believe is still at 2.1.7 can you please update it...
Reply to this email directly or view it on GitHub: https://github.com/awslabs/aws-sdk-xamarin/issues/21#issuecomment-102540530
@tawalke yes the same thing happens with the updated dll's from here. Ie v4
@jasonmc86 For clarity:
When you call this code the below it hangs, are you calling await in the code or Task.Run for the Result. I only got a code snippet here, so I don't see where the async function is being executed by an calling an await or Task.Factory or Task.Run
using (AmazonCognitoSyncClient client = new AmazonCognitoSyncClient (awsUserCreds.AccessKey, awsUserCreds.SecretKey, awsUserCreds.Token, RegionEndpoint.USEast1)) { var datasets = client.ListDatasetsAsync(new ListDatasetsRequest{ }).Result;
var recordsResult = client.ListRecordsAsync (new ListRecordsRequest {
DatasetName = dataSetName,
}).Result;
var result = client.UpdateRecordsAsync (new UpdateRecordsRequest
@tawalke It doesn't matter whether i use await or task.run .. both just never finish the task (ie it hangs) How do i debug the aws source code locally with xamarin studio?
var cognitoCredentials = Credentials as CognitoAWSCredentials;
if (cognitoCredentials != null)
{
string identityId = await cognitoCredentials.GetIdentityIdAsync();
SetIdentity(executionContext, identityId, cognitoCredentials.IdentityPoolId);
}
Is this related?
[Mono] Assembly Loader probing location: '/data/data/com.visionwithapps.socialalarm/files/.override/AWSSDK_XMOBILE.dll'. [Mono] AOT module '/data/data/com.visionwithapps.socialalarm/files/.override/AWSSDK_XMOBILE.dll.so' not found: Cannot load library: load_library[1091]: Library '/data/data/com.visionwithapps.socialalarm/lib/libaot-AWSSDK_XMOBILE.dll.so' not found [Mono] AOT module '/Users/builder/data/lanes/1780/3518c4ce/source/monodroid/builds/install/mono-armv7/lib/mono/aot-cache/arm/AWSSDK_XMOBILE.dll.so' not found: Cannot load library: load_library[1091]: Library '/data/data/com.visionwithapps.socialalarm/lib/libaot-AWSSDK_XMOBILE.dll.so' not found
That is indeed very odd. What platform are you writing on or are you using Xamarin.Forms?
I will have to create a quick client with CognitoSync to see if I get this error, which I haven’t before. So I want to keep the code as you have it and not my interpretation of it
So repeating/asking some things for clarity:
You are or are not passing Cognito Credentials (they are needed)
You are using await (or any PTL methodology) to kick off the request
You are writing classic Xamarin w/Android or Xamarin.Forms?
You are referencing the v4 compiled binary or you compiled the sdk
dSent from Windows Mail
From: jasonmc86 Sent: Saturday, May 16, 2015 12:08 AM To: 'awslabs/aws-sdk-xamarin' Cc: tawalke
Is this related?
[Mono] Assembly Loader probing location: '/data/data/com.visionwithapps.socialalarm/files/.override/AWSSDK_XMOBILE.dll'. [Mono] AOT module '/data/data/com.visionwithapps.socialalarm/files/.override/AWSSDK_XMOBILE.dll.so' not found: Cannot load library: load_library[1091]: Library '/data/data/com.visionwithapps.socialalarm/lib/libaot-AWSSDK_XMOBILE.dll.so' not found [Mono] AOT module '/Users/builder/data/lanes/1780/3518c4ce/source/monodroid/builds/install/mono-armv7/lib/mono/aot-cache/arm/AWSSDK_XMOBILE.dll.so' not found: Cannot load library: load_library[1091]: Library '/data/data/com.visionwithapps.socialalarm/lib/libaot-AWSSDK_XMOBILE.dll.so' not found
— Reply to this email directly or view it on GitHub.
1 I create the cognito client using Amazon.CognitoSync.AmazonCognitoSyncClient client = new AmazonCognitoSyncClient(AuthManager.TempCreds.AccessKey, AuthManager.TempCreds.SecretKey, RegionEndpoint.USEast1);
Okay, I will create a Xamarin.Forms portable project to test this scenario
Sent from Windows Mail
From: jasonmc86 Sent: Saturday, May 16, 2015 12:20 AM To: 'awslabs/aws-sdk-xamarin' Cc: tawalke
1 I create the cognito client using Amazon.CognitoSync.AmazonCognitoSyncClient client = new AmazonCognitoSyncClient(AuthManager.TempCreds.AccessKey, AuthManager.TempCreds.SecretKey, RegionEndpoint.USEast1);
which i believe creates session aws credientials not AWSCognito ones
I was using .Result (of the task) to wait for the result to come back without using await or task.run (although neither helped)
Xamarin Forms
Referencing the compiled binaries from master on github (this repo)
— Reply to this email directly or view it on GitHub.
@tawalke i complied the code on my machine removing the custom CognitoCredentialsRetriever and it is all working now. Could you take a look at what is wrong with the custom handler... Ie Removing the following override in aws xamarin code and my code works fine.
protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
{
pipeline.RemoveHandler<Amazon.Runtime.Internal.CredentialsRetriever>();
pipeline.AddHandlerBefore<Amazon.Runtime.Internal.Marshaller>(new Amazon.CognitoSync.Internal.CognitoCredentialsRetriever(this.Credentials));
}
Thanks,
Jason
Okay will do, I will test with both.
Sent from Windows Mail
From: jasonmc86 Sent: Saturday, May 16, 2015 8:05 PM To: 'awslabs/aws-sdk-xamarin' Cc: Tara Walker
@tawalke i complied the code on my machine removing the custom CognitoCredentialsRetriever and it is all working now. Could you take a look at what is wrong with the custom handler... Ie Removing the following override in aws xamarin code and my code works fine.
protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
{
pipeline.RemoveHandler
Thanks,
Jason
— Reply to this email directly or view it on GitHub.
@tawalke hows the testing of this going?
@findly-jasonmcmonagle I can't get it to error consistently. Can you send me the complete code snippet /class that you are using to call this.
I
@findly-jasonmcmonagle Re-Copying what you have at the top, I'm assuming this is the same code; Going to start a new project and try to make this occur. Are you doing Xamarin.Forms PCL or Xamarin.Forms Shared Project
Hi:
This Beta SDK should now be migrated to use the AWS SDK for .NET with Xamarin has been released. As noted, this release is under AWS SDK for .NET and is in Developer Preview. The Xamarin SDK repo has the latest links for this update, as well as, the updates for the updated NuGet packages.
This should resolve you issue as this has the updated services and codebase desired. See links below: https://github.com/aws/aws-sdk-net https://github.com/aws/aws-sdk-net#nuget-packages
I'm trying to write a update record request in a Portable library for aws in xamarin and i get a not implemented exception.
Code:
Amazon.CognitoSync.AmazonCognitoSyncClient client = new AmazonCognitoSyncClient(AuthManager.TempCreds.AccessKey, AuthManager.TempCreds.SecretKey, RegionEndpoint.USEast1);
What am i doing wrong to get this stack trace?
System.AggregateException: One or more errors occurred ---> System.NotImplementedException: The requested feature is not implemented. 04-09 20:39:47.810 E/mono ( 683): at Amazon.Util.CryptoUtilFactory+CryptoUtil.ComputeHash (System.Byte[] data, HashAlgorithm algorithmName) [0x00000] in:0
04-09 20:39:47.810 E/mono ( 683): at Amazon.Util.CryptoUtilFactory+CryptoUtil.ComputeSHA256Hash (System.Byte[] data) [0x00000] in :0
04-09 20:39:47.810 E/mono ( 683): at Amazon.Runtime.Internal.Auth.AWS4Signer.SetRequestBodyHash (IRequest request) [0x00000] in :0
04-09 20:39:47.810 E/mono ( 683): at Amazon.Runtime.Internal.Auth.AWS4Signer.SignRequest (IRequest request, Amazon.Runtime.ClientConfig clientConfig, Amazon.Runtime.Internal.Util.RequestMetrics metrics, System.String awsAccessKeyId, System.String awsSecretAccessKey) [0x00000] in :0
04-09 20:39:47.810 E/mono ( 683): at Amazon.Runtime.Internal.Auth.AWS4Signer.Sign (IRequest request, Amazon.Runtime.ClientConfig clientConfig, Amazon.Runtime.Internal.Util.RequestMetrics metrics, System.String awsAccessKeyId, System.String awsSecretAccessKey) [0x00000] in :0
04-09 20:39:47.810 E/mono ( 683): at Amazon.Runtime.Internal.Signer.SignRequest (IRequestContext requestContext) [0x00000] in :0
04-09 20:39:47.810 E/mono ( 683): at Amazon.Runtime.Internal.Signer.PreInvoke (IExecutionContext executionContext) [0x00000] in :0
04-09 20:39:47.810 E/mono ( 683): at Amazon.Runtime.Internal.GenericHandler+d__0`1[Amazon.CognitoSync.Model.UpdateRecordsResponse].MoveNext () [0x00000] in :0