Setting the Connections property on the ConnectionsListProperty in the Glue module with a valid string array fails to synthesize with the following error:
System.ArgumentException: Could not convert value 'System.Collections.Generic.Dictionary`2[System.String,System.Object]' with unrecognized type
var job = new Amazon.CDK.AWS.Glue.CfnJob(this, "testJob",
new CfnJobProps {
Name = "test",
GlueVersion = "1.0",
Role = "TestingGlueRole",
MaxCapacity = 4,
Connections = new ConnectionsListProperty
{
Connections = new string[1] { "AcmeData-test1" }
}
});
>
> 1>Unhandled Exception: Amazon.JSII.Runtime.JsiiException: Amazon.JSII.Runtime.JsiiException: Resolution error: System.ArgumentException: Could not convert value 'System.Collections.Generic.Dictionary`2[System.String,System.Object]' with unrecognized type
> 1>Parameter name: value
> 1> at Amazon.JSII.Runtime.Services.Converters.ValueConverter.ConvertAny(IReferenceMap referenceMap, Object value)
> 1> at Amazon.JSII.Runtime.Services.Converters.ValueConverter.TryConvertPrimitive(IReferenceMap referenceMap, Object value, Boolean isOptional, PrimitiveType primitiveType, Object& result)
> 1> at Amazon.JSII.Runtime.Services.Converters.ValueConverter.TryConvert(IOptionalValue optionalValue, IReferenceMap referenceMap, Object value, Object& result)
> 1> at Amazon.JSII.Runtime.Services.Converters.FrameworkToJsiiConverter.TryConvertMap(IReferenceMap referenceMap, TypeReference elementType, Object value, Object& result)
> 1> at Amazon.JSII.Runtime.Services.Converters.ValueConverter.TryConvert(IOptionalValue optionalValue, IReferenceMap referenceMap, Object value, Object& result)
> 1> at Amazon.JSII.Runtime.Deputy.DeputyBase.<>c__DisplayClass20_0.<ConvertArguments>b__0(Parameter parameter, Object frameworkArgument)
> 1> at System.Linq.Enumerable.ZipIterator[TFirst,TSecond,TResult](IEnumerable`1 first, IEnumerable`1 second, Func`3 resultSelector)+MoveNext()
> 1> at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
> 1> at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
> 1> at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
> 1> at Amazon.JSII.Runtime.Deputy.DeputyBase.<InvokeMethodCore>g__GetResult|18_0[T](<>c__DisplayClass18_0`1& )
> 1> at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeMethodCore[T](JsiiMethodAttribute methodAttribute, Object[] arguments, Func`3 beginFunc, Func`3 invokeFunc)
> 1> at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeInstanceMethod[T](Object[] arguments, String methodName).
> 1>Object creation stack:
> 1> at new Intrinsic (C:\Users\user1\AppData\Local\Temp\jsii-kernel-WyVR6s\node_modules\@aws-cdk\core\lib\private\intrinsic.js:20:44)
> 1> at new PostResolveToken (C:\Users\user1\AppData\Local\Temp\jsii-kernel-WyVR6s\node_modules\@aws-cdk\core\lib\util.js:72:9)
> 1> at CfnJob._toCloudFormation (C:\Users\user1\AppData\Local\Temp\jsii-kernel-WyVR6s\node_modules\@aws-cdk\core\lib\cfn-resource.js:167:39)
> 1> at node.addReference.resolve_1.findTokens (C:\Users\user1\AppData\Local\Temp\jsii-kernel-WyVR6s\node_modules\@aws-cdk\core\lib\cfn-element.js:84:77)
> 1> at Object.findTokens (C:\Users\user1\AppData\Local\Temp\jsii-kernel-WyVR6s\node_modules\@aws-cdk\core\lib\private\resolve.js:126:13)
> 1> at CfnJob.prepare (C:\Users\user1\AppData\Local\Temp\jsii-kernel-WyVR6s\node_modules\@aws-cdk\core\lib\cfn-element.js:84:49)
> 1> at _wrapSandboxCode (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6498:51)
> 1> at Kernel._wrapSandboxCode (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:7131:20)
> 1> at ret._ensureSync (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6498:25)
> 1> at Kernel._ensureSync (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:7102:20)
> 1> at Kernel.invoke (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6497:26)
> 1> at KernelHost.processRequest (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6191:28)
> 1> at completeCallback (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6164:25)
> 1> at KernelHost.callbackHandler (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6145:16)
> 1> at KernelHost.kernel.jsii_kernel_1.Kernel.cb [as callbackHandler] (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6129:59)
> 1> at CfnJob.value (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6848:41)
> 1> at Function.prepare (C:\Users\user1\AppData\Local\Temp\jsii-kernel-WyVR6s\node_modules\@aws-cdk\core\lib\construct.js:89:27)
> 1> at Function.synth (C:\Users\user1\AppData\Local\Temp\jsii-kernel-WyVR6s\node_modules\@aws-cdk\core\lib\construct.js:52:14)
> 1> at App.synth (C:\Users\user1\AppData\Local\Temp\jsii-kernel-WyVR6s\node_modules\@aws-cdk\core\lib\app.js:67:52)
> 1> at _wrapSandboxCode (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6498:51)
> 1> at Kernel._wrapSandboxCode (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:7131:20)
> 1> at ret._ensureSync (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6498:25)
> 1> at Kernel._ensureSync (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:7102:20)
> 1> at Kernel.invoke (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6497:26)
> 1> at KernelHost.processRequest (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6191:28)
> 1> at KernelHost.run (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6137:14)
> 1> at processRequest (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6137:45)
> 1> at KernelHost.processRequest (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6233:16)
> 1> at KernelHost.run (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6137:14)
> 1> at processRequest (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6137:45)
> 1> at KernelHost.processRequest (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6233:16)
> 1> at KernelHost.run (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6137:14)
> 1> at processRequest (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6137:45)
> 1> at promise.then.val (C:\Users\user1\AppData\Local\Temp\l1havt1r.uvu\jsii-runtime.js:6218:21)
> 1> at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
> 1> at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
> 1> at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
> 1> at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
> 1> at Amazon.JSII.Runtime.Deputy.DeputyBase.<InvokeMethodCore>g__GetResult|18_0[T](<>c__DisplayClass18_0`1& )
> 1> at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeMethodCore[T](JsiiMethodAttribute methodAttribute, Object[] arguments, Func`3 beginFunc, Func`3 invokeFunc)
> 1> at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeInstanceMethod[T](Object[] arguments, String methodName)
> 1> at Amazon.CDK.CfnElement.Prepare()
> 1> at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
> 1> at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
> 1> at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
> 1> at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
> 1> at Amazon.JSII.Runtime.Deputy.DeputyBase.<InvokeMethodCore>g__GetResult|18_0[T](<>c__DisplayClass18_0`1& )
> 1> at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeMethodCore[T](JsiiMethodAttribute methodAttribute, Object[] arguments, Func`3 beginFunc, Func`3 invokeFunc)
> 1> at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeInstanceMethod[T](Object[] arguments, String methodName)
> 1> at Acme.Data.CloudFormation.Program.Stuff() in D:\source\acme-providerdata\Acme.Data.CloudFormation\Program.cs:line 24
> 1> at Acme.Data.CloudFormation.Program.Main(String[] args) in D:\source\acme-providerdata\Acme.Data.CloudFormation\Program.cs:line 16
> 1>Subprocess exited with error 3762504530
> 1>D:\source\acme-providerdata\Acme.Data.CloudFormation\Acme.Data.CloudFormation.csproj(55,5): error MSB3073: The command "cdk synth -a "dotnet bin\Debug\netcoreapp2.1\Acme.Data.CloudFormation.dll"" exited with code 1.
>
Relates https://github.com/aws/aws-cdk/issues/2496
This will be fixed in the next release of the Amazon.JSII.Runtime nuget package
@assyadh Updated to latest release from yesterday and still failing with the same error:

@rschiefer Try to install the latest JSII Runtime
Install-Package Amazon.JSII.Runtime -Version 0.16.0 or the latest CDK, 1.6.1
New error: Unhandled Exception: Amazon.JSII.Runtime.JsiiException: Amazon.JSII.Runtime.JsiiException: Resolution error: System.ArgumentException: Could not infer JSII type for .NET type 'JArray'

@rschiefer Welcome to the club of https://github.com/aws/aws-cdk/issues/3244 !
I'm also experiencing the original issue with Amazon.CDK 1.7.0-devpreview (and Amazon.JSII.Runtime 0.16.0).
var role = new Role(this, "rolepatterns", new RoleProps
{
RoleName = "rolepatterns",
AssumedBy = new Amazon.CDK.AWS.IAM.ServicePrincipal("lambda"),
ManagedPolicies = new[]
{
ManagedPolicy.FromAwsManagedPolicyName("service-role/AWSLambdaSQSQueueExecutionRole")
},
InlinePolicies = new Dictionary<string, PolicyDocument>
{
{ "AllowSNSPublish", new PolicyDocument(
new PolicyDocumentProps
{
Statements = new [] {
new PolicyStatement(
new PolicyStatementProps
{
Effect = Effect.ALLOW,
Actions = new[] { "sns:Publish" },
Resources = new[] { "*" }
})
}
})
}
}
});
Most helpful comment
Relates https://github.com/aws/aws-cdk/issues/2496
This will be fixed in the next release of the Amazon.JSII.Runtime nuget package