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

TerraformIterator: Tests fail for official example of "Using Iterators on Complex Lists" #3523

Open
1 task
rexebin opened this issue Feb 26, 2024 · 0 comments
Labels
bug Something isn't working new Un-triaged issue

Comments

@rexebin
Copy link

rexebin commented Feb 26, 2024

Expected Behavior

Tests should pass.

Actual Behavior

Example code: Using Iterators on Complex Lists

Test fails with error:

System.TypeInitializationException: The type initializer for 'IteratorStack.Tests.IteratorStackTests' threw an exception.

System.TypeInitializationException
The type initializer for 'IteratorStack.Tests.IteratorStackTests' threw an exception.
   at IteratorStack.Tests.IteratorStackTests.CheckValidity() in C:\dev\CdkTfTestFailExample\IteratorStack.Tests\IteratorStackTests.cs:line 15
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

System.ArgumentException
Could not infer JSII type for .NET type '_Proxy' (Parameter 'type')
   at Amazon.JSII.Runtime.Services.Converters.FrameworkToJsiiConverter.InferType(IReferenceMap referenceMap, Type type)
   at Amazon.JSII.Runtime.Services.Converters.FrameworkToJsiiConverter.InferType(IReferenceMap referenceMap, Object value)
   at Amazon.JSII.Runtime.Services.Converters.ValueConverter.ConvertAny(Type type, IReferenceMap referenceMap, Object value)
   at Amazon.JSII.Runtime.Services.Converters.ValueConverter.TryConvertPrimitive(Type type, IReferenceMap referenceMap, Object value, Boolean isOptional, PrimitiveType primitiveType, Object& result)
   at Amazon.JSII.Runtime.Services.Converters.ValueConverter.TryConvert(IOptionalValue optionalValue, Type type, IReferenceMap referenceMap, Object value, Object& result)
   at Amazon.JSII.Runtime.Services.Converters.FrameworkToJsiiConverter.TryConvert(IOptionalValue optionalValue, IReferenceMap referenceMap, Object value, Object& result)
   at Amazon.JSII.Runtime.Deputy.DeputyBase.<>c__DisplayClass20_0.<ConvertArguments>b__0(Parameter parameter, Object frameworkArgument)
   at System.Linq.Enumerable.ZipIterator[TFirst,TSecond,TResult](IEnumerable`1 first, IEnumerable`1 second, Func`3 resultSelector)+MoveNext()
   at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
   at Amazon.JSII.Runtime.Deputy.DeputyBase.ConvertArguments(Parameter[] parameters, Object[] arguments)
   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.InvokeStaticMethod[T](Type type, Type[] parameterTypes, Object[] arguments, String methodName)
   at HashiCorp.Cdktf.Token.AsList(Object value, IEncodingOptions options)
   at IteratorStack.IteratorStack..ctor(Construct scope, String id) in C:\dev\CdkTfTestFailExample\IteratorStack\IteratorStack.cs:line 47
   at IteratorStack.Tests.IteratorStackTests..cctor() in C:\dev\CdkTfTestFailExample\IteratorStack.Tests\IteratorStackTests.cs:line 8

Steps to Reproduce

See repository:
https://github.com/rexebin/CdkTfTestFailExample

Run test to see failed messages with line 50 in IteratorStack.cs:
ValidationRecordFqdns = Token.AsList(recordsIterator.PluckProperty("fqdn"))

Comment out line 50, uncomment line 51 to see test pass.

Versions

language: csharp
cdktf-cli: 0.20.3
node: v20.11.0
cdktf: 0.20.3
constructs: 10.3.0
jsii: 1.94.0
terraform: 1.7.1
arch: x64
os: win32 10.0.22631
dotnet: 8.0.102
providers
HashiCorp.Cdktf.Providers.Aws (PREBUILT)
terraform provider version: 5.38.0
prebuilt provider version: 19.7.0
cdktf version: ^0.20.0

Providers

┌───────────────┬──────────────────┬─────────┬────────────┬───────────────────────────────┬─────────────────┐
│ Provider Name │ Provider Version │ CDKTF │ Constraint │ Package Name │ Package Version │
├───────────────┼──────────────────┼─────────┼────────────┼───────────────────────────────┼─────────────────┤
│ aws │ 5.38.0 │ ^0.20.0 │ │ HashiCorp.Cdktf.Providers.Aws │ 19.7.0 │
└───────────────┴──────────────────┴─────────┴────────────┴───────────────────────────────┴─────────────────┘

Gist

No response

Possible Solutions

No response

Workarounds

No response

Anything Else?

No response

References

No response

Help Wanted

  • I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@rexebin rexebin added bug Something isn't working new Un-triaged issue labels Feb 26, 2024
@rexebin rexebin changed the title TerraformIterator: Official example fails the test TerraformIterator: Tests fail for official example of "Using Iterators on Complex Lists" Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working new Un-triaged issue
Projects
None yet
Development

No branches or pull requests

1 participant