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

LaunchTemplateDataProperty/CfnLaunchTemplate_ fails with any complex property set #2496

Closed
McDoit opened this issue May 7, 2019 · 4 comments · Fixed by aws/jsii#736
Closed
Assignees
Labels
bug This issue is a bug. language/dotnet Related to .NET bindings

Comments

@McDoit
Copy link
Contributor

McDoit commented May 7, 2019

Describe the bug
LaunchTemplateDataProperty/CfnLaunchTemplate_ fails with any complex property set

Works in 0.28

To Reproduce

Add the following to the C# HelloStack of the init app with language csharp

var launchTemplateData = new LaunchTemplateDataProperty
            {
                InstanceType = "t3.medium",
                Monitoring = new MonitoringProperty { Enabled = true }
            };

            var cfnLaunchTemplate = new CfnLaunchTemplate_(this, "template", new CfnLaunchTemplateProps
            {
                LaunchTemplateData = launchTemplateData,
                LaunchTemplateName = "template"
            });

And then run the app
Build works fine

Removing the Monitoring = new MonitoringProperty { Enabled = true } makes the app able to run

Exception message from the app:

Amazon.JSII.Runtime.JsiiException: While synthesizing test-stack/template: System.ArgumentException: Could not convert value 'System.Collections.Generic.Dictionary`2[System.String,System.Object]' with unrecognized type
Parameter name: value
   at Amazon.JSII.Runtime.Services.Converters.ValueConverter.ConvertAny(IReferenceMap referenceMap, Object value)
   at Amazon.JSII.Runtime.Services.Converters.ValueConverter.TryConvertPrimitive(IReferenceMap referenceMap, Object value, Boolean isOptional, PrimitiveType primitiveType, Object& result)
   at Amazon.JSII.Runtime.Services.Converters.ValueConverter.TryConvert(IOptionalValue optionalValue, IReferenceMap referenceMap, Object value, Object& result)
   at Amazon.JSII.Runtime.Services.Converters.FrameworkToJsiiConverter.TryConvertMap(IReferenceMap referenceMap, TypeReference elementType, Object value, Object& result)
   at Amazon.JSII.Runtime.Services.Converters.ValueConverter.TryConvert(IOptionalValue optionalValue, IReferenceMap referenceMap, Object value, Object& result)
   at Amazon.JSII.Runtime.CallbackExtensions.InvokeCallback(Callback callback, IReferenceMap referenceMap, IFrameworkToJsiiConverter converter, String& error)
   at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
   at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
   at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
   at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
   at Amazon.JSII.Runtime.Deputy.DeputyBase.<InvokeMethodCore>g__GetResult|18_0[T](<>c__DisplayClass18_0`1& )
   at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeMethodCore[T](JsiiMethodAttribute methodAttribute, Object[] arguments, Func`3 beginFunc, Func`3 invokeFunc)
   at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeInstanceMethod[T](Object[] arguments, String methodName)
   at Amazon.CDK.CfnElement.Prepare()

Expected behavior
The app to run and produce a launch template with all properties set

Version:

  • OS - Win 10
  • Programming Language - C#
  • CDK Version - 0.31
@McDoit McDoit added the bug This issue is a bug. label May 7, 2019
@eladb eladb added the language/dotnet Related to .NET bindings label May 14, 2019
@jsteinich
Copy link

I'm getting what appears to be the same issue using CfnCloudFrontOriginAccessIdentityProps.CloudFrontOriginAccessIdentityConfig

@RomainMuller
Copy link
Contributor

Seems to be the same issue as #3580

@McDoit
Copy link
Contributor Author

McDoit commented Aug 15, 2019

I don't know if anything like that can help, as there is no un-typed assignments in this constructor?

var launchTemplateData = new LaunchTemplateDataProperty
            {
                InstanceType = "t3.medium",
                Monitoring = new MonitoringProperty { Enabled = true }
            };

@assyadh
Copy link
Contributor

assyadh commented Aug 23, 2019

Fix in PR aws/jsii#736

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. language/dotnet Related to .NET bindings
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants