1

I am trying to use AWS S3 library to upload files to S3.

The issue is, when I add the S3 Library and call its function, it gives me the error below:

An unhandled exception of type 'System.MissingMethodException' occurred in AnotherS3Test.exe

Additional information: Method not found: 'System.IAsyncResult Amazon.Runtime.SharedInterfaces.ICoreAmazonS3.BeginDelete(System.String, System.String, System.Collections.Generic.IDictionary`2, System.AsyncCallback, System.Object)'.

I am using Visual Studio 2015 and get the S3 packages using NuGet Package Manager. Everything works fine if I change the version of the app to use .Net 3.5, but as soon as I change the version to 4, 4.5 or 4.6, I start getting the error above even if I create a new project and get the S3 assembly again from NuGet Package Manager to make sure the app uses the correct AWS libraries (compatible with the current version of .Net selected).

Can someone please help? maybe its something basic I've missed

Simply Ged
  • 8,250
  • 11
  • 32
  • 40

2 Answers2

1

My guess is you somehow got the .NET 3.5 version of the AWS SDK for .NET installed into the GAC. .NET will pick the GAC version versus your directly referenced version. It is the evil of the GAC. This might help inspect your GAC. https://learn.microsoft.com/en-us/dotnet/framework/app-domains/how-to-view-the-contents-of-the-gac

Norm Johanson
  • 2,964
  • 14
  • 13
  • This is a good guess, OP you can check this using the Modules window, in Visual Studio the Debug Menu > Windows > Modules. – Jeremy Thompson Feb 06 '20 at 04:24
  • @Norm Johanson I tried uninstalling all AWS components but the assemblies in GAC are still there – Cosmo Kramer Feb 06 '20 at 05:09
  • 1
    @Jeremy Thompson I tried using the Modules window and it showed that it is using assemblies from GAC. Is there any way I can force Visual Studio to use assemblies in a folder other than GAC? I tried uninstalling the AWS assemblies but it failed due to some dependency issue – Cosmo Kramer Feb 06 '20 at 05:11
  • No AWS components install themselves into the GAC as I am a true hater of the GAC. It was most likely some other third part tool that installed the dll into the GAC. I would recommend manually removing the AWS assemblies from the GAC. Here is the MSDN article on how to do that. https://learn.microsoft.com/en-us/dotnet/framework/app-domains/how-to-remove-an-assembly-from-the-gac – Norm Johanson Feb 06 '20 at 05:12
  • @Norm Johanson I am also starting to hate GAC, I tried to uninstall the assemblies but can't do it as there is a dependency issue – Cosmo Kramer Feb 06 '20 at 05:18
  • Here's the QA to bypass the GAC https://stackoverflow.com/q/1606867/495455 – Jeremy Thompson Feb 06 '20 at 06:32
  • 1
    Thanks @JeremyThompson for your help. I actually ended up running Visual Studio in a different machine which had no AWS components installed (which meant no assemblies in the GAC) and I had no trouble at all – Cosmo Kramer Feb 11 '20 at 07:06
0

This error as here says https://learn.microsoft.com/en-us/dotnet/api/system.missingmethodexception?view=netframework-4.8 means you are accessing something does not exist.
1- Did you add AWS SDK for NET4.5 ? there are two folders in AWS SDK if you see,

2- my general suggestion is to move to 2019 i had few issues with 17 even.

Azzurro94
  • 479
  • 1
  • 7
  • 19