Skip to content

Getting a PlatformNotSupportedException from AmazonDynamoDBConfig type initializer #3

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

Closed
erick-thompson opened this issue Dec 2, 2016 · 7 comments
Labels
bug This issue is a bug. feature-request A feature should be added or improved.

Comments

@erick-thompson
Copy link

I'm very excited about this functionality. It's nice to not have C# be left out in the cold. :)

I'm attempting to get an existing ASP.NET Core Web API app working under the serverless model. I am able to get the application deployed and running, but when I attempt to use DynamoDB, I'm getting a static initializer exception, which is of course uncatchable. I've pasted the exception details below. I'm running with AWSSDK.Core version 3.3.5 and AWSSDK.DynamoDBv2 version 3.3.1 (same version used in the demo) and using BasicAWSCredentials.

Is there something specific to the way that I'm using the Dynamo SDK that is causing this error?

System.TypeInitializationException: The type initializer for 'Amazon.DynamoDBv2.AmazonDynamoDBConfig' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Amazon.Util.Internal.PlatformServices.ServiceFactory' threw an exception. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.PlatformNotSupportedException: Operation is not supported on this platform.

at System.Runtime.InteropServices.RuntimeInformation.get_OSDescription()
at Amazon.Util.Internal.InternalSDKUtils.DetermineOS()
at Amazon.Util.Internal.PlatformServices.EnvironmentInfo..ctor()
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at Amazon.Util.Internal.PlatformServices.ServiceFactory..ctor()
at Amazon.Util.Internal.PlatformServices.ServiceFactory..cctor()

--- End of inner exception stack trace ---
at Amazon.Util.Internal.InternalSDKUtils.BuildUserAgentString(String serviceSdkVersion)
at Amazon.DynamoDBv2.AmazonDynamoDBConfig..cctor()

@erick-thompson
Copy link
Author

Is there any additional information I can provide?

@normj
Copy link
Member

normj commented Dec 6, 2016

Thanks for letting us know about the issue. Can you share your project.json file? I want to see if there is anything different in there versus how we set up our demo.

@normj normj added the bug This issue is a bug. label Dec 7, 2016
@normj
Copy link
Member

normj commented Dec 7, 2016

This is also being tracked in the aws forums

https://forums.aws.amazon.com/thread.jspa?threadID=244314&tstart=0

@erick-thompson
Copy link
Author

It sounds like you've been able to repo the problem independently. I'll post my project.json file tomorrow to help out.

@normj
Copy link
Member

normj commented Dec 7, 2016

I push out version 3.3.5.1 of AWSSDK.Core which added defensive code around getting platform information. Hopefully that will fix the issue. I also pushed out new patch version of all the service packages like AWSSDK.DynamoDBv2 that require the latest core. So if you bump your dependency on AWSSDK.DynamoDBv2 to 3.3.1.1 that will pick up the new core change.

@erick-thompson
Copy link
Author

This did the trick. Thanks!

@avinashl3175
Copy link

Thanks @normj , it worked for me by replacing AWSSDK.DynamoDBv2 version to 3.3.1.1 .

Thanks!!

@diehlaws diehlaws added feature-request A feature should be added or improved. and removed Enhancement labels Jan 3, 2019
ganeshnj pushed a commit that referenced this issue Nov 2, 2021
^ This is the 1st commit message:

ci: update CI to generate nuget package

^ The commit message #2 will be skipped:

^ oh git

^ The commit message #3 will be skipped:

^ rename artifact
aws-sdk-dotnet-automation added a commit that referenced this issue Feb 26, 2025
ashishdhingra pushed a commit that referenced this issue Feb 27, 2025
* Release 2025-02-26 #3

* Update test app CloudFormation templates

* Updated changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

5 participants