in

Does anyone have an example using AWS S3 in Visual Studio 2022 with Xamarin Forms


New to this particular game and struggling.
Using Visual Studio Community Edition 2022 I have added the Mobile development with .NET to allow me to build cross platform apps for Android and iOS using Xamarin.
VS NuGet Package Manager Install: AWSSKD.Core 3.7.5.13 and AWSSKD.S3 3.7.7.11
I also have the Amazon Toolkit installed and a default profile setup with my credentials and secret key, from there I can see my S3.Buckets
I have built a simple app with buttons that update labels, to prove I can get them on the screen and manipulate them. It runs in the emulator and on an Android phone
I now need to add Amazon AWS S3 functionality. I cannot find any examples that support VS 2022 with Xamarin.
I found https://github.com/awslabs/aws-sdk-net-samples/tree/master/XamarinSamples/S3, this wants COGNITO_POOL_ID, I do not have one
I found https://github.com/aws-samples/aws-net-guides/tree/master/Storage/S3, this is a .NET Core based console app, I tried the copying the code to my app but it hangs at Task.WaitAll(res)

When a button is pressed this code is run

Task.Run(() => foo());
  private void foo()
  {
      var s3 = new AmazonS3Client(RegionEndpoint.EUWest1);
      CreateBucket(s3);
  }
  
  static void CreateBucket(IAmazonS3 s3)
  {
      var req = new PutBucketRequest
      {
          BucketName = bucketName,
          BucketRegion = S3Region.EUW1
      };
      Task<PutBucketResponse> res = s3.PutBucketAsync(req);
      Task.WaitAll(res); //code hangs here, Bucket does not get created in line above.
  
      if (res.IsCompleted) //IsCompletedSuccessfully
      {
          Console.WriteLine("New S3 bucket created: {0}", bucketName);
      }
  }

The output window shows this
[Choreographer] Skipped 605 frames! The application may be doing too much work on its main thread.
[OpenGLRenderer] Davey! duration=10105ms; Flags=0, IntendedVsync=59162081149974, Vsync=59162081149974, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=59162082503300, AnimationStart=59162082553800, PerformTraversalsStart=59162082729300, DrawStart=59172181927600, SyncQueued=59172183702200, SyncStart=59172184646800, IssueDrawCommandsStart=59172184728600, SwapBuffers=59172186371500, FrameCompleted=59172187859300, DequeueBufferDuration=616100, QueueBufferDuration=599800, GpuCompleted=-8410199027005521942,
[monodroid-assembly] open_from_bundles: failed to load assembly log4net.dll
Loaded assembly: /data/data/com.companyname.simpe_demo_3/files/.override/System.Xml.Linq.dll [External]
Loaded assembly: /data/data/com.companyname.simpe_demo_3/files/.override/System.Net.Http.dll [External]
[me.simpe_demo_] Explicit concurrent copying GC freed 3888(374KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2626KB/5252KB, paused 329us total 6.502ms

I can supply complete project if required



Source: https://stackoverflow.com/questions/70715345/does-anyone-have-an-example-using-aws-s3-in-visual-studio-2022-with-xamarin-form

An expense tracker made with React

Identify overlap in group membership