You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An unhandled exception is thrown when using a .NET construct compiled using jsii. No idea what is causing this (exception is being thrown at var app = new App();. I don't import anything in the project that isn't from the CDK library except for path and fs. I've tried setting "type": "module" in my package.json, but it doesn't prevent this error from occurring. The stack trace doesn't really appear to be helpful in determining the cause.
Expected Behavior
Not to receive an exception.
Current Behavior
Unhandled exception. System.Exception: Cannot use import statement outside a module
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponseTResponse
at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
at Amazon.JSII.Runtime.Services.Client.Load(LoadRequest request)
at Amazon.JSII.Runtime.Services.Client.Load(String name, String version, String tarball)
at Amazon.JSII.Runtime.Services.Client.LoadPackage(String package, String version, String tarballPath)
at Amazon.JSII.Runtime.Deputy.JsiiTypeAttributeBase.Load(Assembly assembly)
at Amazon.JSII.Runtime.Deputy.JsiiTypeAttributeBase..ctor(Type nativeType, String fullyQualifiedName)
at Amazon.JSII.Runtime.Deputy.JsiiClassAttribute..ctor(Type nativeType, String fullyQualifiedName, String parametersJson)
at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, RuntimeType type, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, RuntimeType type, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder1 derivedAttributes)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.Attribute.GetCustomAttributes(MemberInfo element, Type attributeType, Boolean inherit)
at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](MemberInfo element)
at Amazon.JSII.Runtime.Services.TypeCache.CacheTypes(Assembly assembly)
at Amazon.JSII.Runtime.Services.TypeCache.Refresh()
at Amazon.JSII.Runtime.Services.TypeCache.TryGetType[T](String fullyQualifiedName)
at Amazon.JSII.Runtime.Services.TypeCache.TryGetInterfaceType(String fullyQualifiedName)
at Amazon.JSII.Runtime.Services.Converters.ValueConverter.g__IsReferenceType|17_0(<>c__DisplayClass17_0&)
at Amazon.JSII.Runtime.Services.Converters.ValueConverter.TryConvertCustomType(Type type, IReferenceMap referenceMap, Object value, Boolean isOptional, String fullyQualifiedName, 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.b__0(Parameter parameter, Object frameworkArgument)
at System.Linq.Enumerable.ZipIterator[TFirst,TSecond,TResult](IEnumerable1 first, IEnumerable1 second, Func3 resultSelector)+MoveNext() at System.Collections.Generic.LargeArrayBuilder1.AddRange(IEnumerable1 items) at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable1 source)
at Amazon.JSII.Runtime.Deputy.DeputyBase.ConvertArguments(Parameter[] parameters, Object[] arguments)
at Amazon.JSII.Runtime.Deputy.DeputyBase..ctor(DeputyProps props)
at Constructs.Construct..ctor(DeputyProps props)
at Amazon.CDK.Stage..ctor(DeputyProps props)
at Amazon.CDK.App..ctor(IAppProps props)
at Program.Main(String[] args) in /Users/mhaken/source/workshop/cdk/Program.cs:line 16
Reproduction Steps
Add the nuget package and run var app = new App()
Possible Solution
No response
Additional Information/Context
No response
SDK version used
5.4.9 (build 91580f2)
Environment details (OS name and version, etc.)
darwin
The text was updated successfully, but these errors were encountered:
Going to answer my own question in case this comes up in a search. I was exporting a bunch of classes and interfaces in my "main" file. In a few other .ts files i was importing from this main file, effectively making a circular import/export. Importing directly from the appropriate file containing the class fixed the problem.
This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
Describe the bug
An unhandled exception is thrown when using a .NET construct compiled using jsii. No idea what is causing this (exception is being thrown at var app = new App();. I don't import anything in the project that isn't from the CDK library except for path and fs. I've tried setting "type": "module" in my package.json, but it doesn't prevent this error from occurring. The stack trace doesn't really appear to be helpful in determining the cause.
Expected Behavior
Not to receive an exception.
Current Behavior
Unhandled exception. System.Exception: Cannot use import statement outside a module
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponseTResponse
at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
at Amazon.JSII.Runtime.Services.Client.Load(LoadRequest request)
at Amazon.JSII.Runtime.Services.Client.Load(String name, String version, String tarball)
at Amazon.JSII.Runtime.Services.Client.LoadPackage(String package, String version, String tarballPath)
at Amazon.JSII.Runtime.Deputy.JsiiTypeAttributeBase.Load(Assembly assembly)
at Amazon.JSII.Runtime.Deputy.JsiiTypeAttributeBase..ctor(Type nativeType, String fullyQualifiedName)
at Amazon.JSII.Runtime.Deputy.JsiiClassAttribute..ctor(Type nativeType, String fullyQualifiedName, String parametersJson)
at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, RuntimeType type, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, RuntimeType type, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder
1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder
1 derivedAttributes)at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.Attribute.GetCustomAttributes(MemberInfo element, Type attributeType, Boolean inherit)
at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](MemberInfo element)
at Amazon.JSII.Runtime.Services.TypeCache.CacheTypes(Assembly assembly)
at Amazon.JSII.Runtime.Services.TypeCache.Refresh()
at Amazon.JSII.Runtime.Services.TypeCache.TryGetType[T](String fullyQualifiedName)
at Amazon.JSII.Runtime.Services.TypeCache.TryGetInterfaceType(String fullyQualifiedName)
at Amazon.JSII.Runtime.Services.Converters.ValueConverter.g__IsReferenceType|17_0(<>c__DisplayClass17_0&)
at Amazon.JSII.Runtime.Services.Converters.ValueConverter.TryConvertCustomType(Type type, IReferenceMap referenceMap, Object value, Boolean isOptional, String fullyQualifiedName, 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.b__0(Parameter parameter, Object frameworkArgument)
at System.Linq.Enumerable.ZipIterator[TFirst,TSecond,TResult](IEnumerable
1 first, IEnumerable
1 second, Func3 resultSelector)+MoveNext() at System.Collections.Generic.LargeArrayBuilder
1.AddRange(IEnumerable1 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..ctor(DeputyProps props)
at Constructs.Construct..ctor(DeputyProps props)
at Amazon.CDK.Stage..ctor(DeputyProps props)
at Amazon.CDK.App..ctor(IAppProps props)
at Program.Main(String[] args) in /Users/mhaken/source/workshop/cdk/Program.cs:line 16
Reproduction Steps
Add the nuget package and run
var app = new App()
Possible Solution
No response
Additional Information/Context
No response
SDK version used
5.4.9 (build 91580f2)
Environment details (OS name and version, etc.)
darwin
The text was updated successfully, but these errors were encountered: