Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net v4.7 is not supported? #1409

Closed
wrjanan opened this issue Sep 23, 2019 · 1 comment
Closed

net v4.7 is not supported? #1409

wrjanan opened this issue Sep 23, 2019 · 1 comment

Comments

@wrjanan
Copy link

wrjanan commented Sep 23, 2019

I have a program that runs 2 different versions

  1. 4.5.2
  2. 4.7

The portion that works with AWS is:

var fileTransferUtility = new TransferUtility(S3Client);

Expected Behavior

Program should run successfully and transfer files for multiple versions

Current Behavior

Everything runs smoothly on v4.5.2

On v4.7 however, I receive this error message on the specific line that initiates

new TransferUtility(S3Client);
Exception thrown: 'System.TypeLoadException' in AWSSDK.CognitoIdentity.dll

While S3Client is a staticinitiated file:

private static IAmazonS3 S3Client
        {
            get
            {
                if (_s3client == null)
                    _s3client = new AmazonS3Client(Credentials, Region);

                return _s3client;
            }
        }


private static AWSCredentials Credentials
        {
            get
            {
                if (_credentials == null)
                    _credentials = new CognitoAWSCredentials(IdentityPoolId, Region); // errant line

                return _credentials;
            }
        }

Possible Solution

Am not quite certain, possibly a nuget version that has the v4.7?

Context

Am trying to get AWS to work on both net versions of v4.5.2 and v4.7 build configurations

Your Environment

  • AWSSDK.Core version used: 3.3.103.42
  • Service assembly and version used: 64 bit
  • Operating System and version: Windows 10
  • Visual Studio version: 2019
  • Targeted .NET platform: v4.5.2 & v4.7
@wrjanan
Copy link
Author

wrjanan commented Sep 26, 2019

Finally fixed this issue!

What happened was with the 4.7 .net framework, somehow the assembly being loaded was already being used by a program that was loading my plugin. Since it was being loaded already, the debugger module window showed a totally different version that wasn't referencing the assembly that I had built.


            List<string> assemblies = new List<String>() {
                "AWSSDK.S3.dll",
                "AWSSDK.Core.dll",
                "AWSSDK.CognitoIdentity.dll",
                "AWSSDK.SecurityToken.dll"
            };
            string folderPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            foreach (string assemblyName in assemblies)
            {
                string assemblyPath = Path.Combine(folderPath, assemblyName);
                if (!File.Exists(assemblyPath))
                    continue;
                Assembly assembly = Assembly.LoadFrom(assemblyPath);

            }

Now the assembly that is loaded is referencing from the right path and is working!

@wrjanan wrjanan closed this as completed Sep 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant