Joshua
Joshua

Reputation: 138

C# AmazonS3 error, AmazonS3Client.cs source not found?

I am running into an issue. I am using Amazon S3 services to upload files to a bucket. The files do upload, however, the issue I run into is when I need to walk through my code. When I get to AmazonS3Client client = new AmazonS3Client() Visual Studio throws up a page "Source Not Found", You need to find AmazonS3Client.cs to view the source for the current call stack frame and then suggests I find the file or it attempts to get me to view the disassembly in the Disassembly window. There isn't much code to accompany this but I have put it below. Additionally, I get the same issue with the PutObjectRequest object. I have my credentials listed in the web.config file for testing but will be moved once in production. I also listed that below as well. Thanks for the help.

        <add key="AWSProfileName" value="myprofilename"/>
        <add key="AWSRegion" value="us-east-1" />
        <add key="AWSAccessKey" value="xxxxxxxxxxxxxxxxxx" />
        <add key="AWSSecretKey" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />

        try
        {
            AmazonS3Client client = new AmazonS3Client();

            PutObjectRequest request = new PutObjectRequest();
            request.BucketName = "bucketname";
            request.Key = filename;
            request.FilePath = filepath;
            client.PutObject(request);
        }
        catch (AmazonS3Exception ex)
        {
            throw ex;
        }

Upvotes: 0

Views: 1887

Answers (2)

Joshua
Joshua

Reputation: 138

I found the issue. The dll from NuGet is the cause of the problem. I have switched over to the dll from the AWS SDK for .NET from Amazon. Although their documentation states that the NuGet package is always up to date there must be an issue. Thanks for the help anyways.

Upvotes: 0

Kaido
Kaido

Reputation: 3931

I get similar behaviour from the nuget sdk version 2 (in my case "AWSCredentials.cs" not found).

Press cancel on the file dialog, and you should be presented with the exception and the stack trace (Visual Studio Call Stack window). You cannot see the line of AWS which faulted without the source files as a reference, but you can traverse the call stack to see which line of your code errored.

EDIT: I looked into packages\AWSSDK.2.3.53.0\lib and in fact the nuget package contains pdb files and debug mode dlls BUT not the source code. Deleting the AWSSDK.pdb files here prevents visual studio from looking for the AWSSDK source code during your debug sessions.

Upvotes: 1

Related Questions