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

.NET CDK 1.16.2 JsiiException exception on synth at CodeCommit.Repository.OnCommit #4989

Closed
vgribok opened this issue Nov 12, 2019 · 3 comments
Assignees
Labels
bug This issue is a bug. language/dotnet Related to .NET bindings needs-triage This issue or PR still needs to be triaged. p0

Comments

@vgribok
Copy link

vgribok commented Nov 12, 2019

After upgrading my working simple CI/CD CDK project from .NET CDK 1.11.0 to CDK 1.16.2, I started getting an exception with message:

Amazon.JSII.Runtime.JsiiException: Amazon.JSII.Runtime.JsiiException: Amazon.JSII.Runtime.JsiiException: System.InvalidCastException: Unable to cast Amazon.JSII.Runtime.Deputy.AnonymousObject into Amazon.CDK.AWS.Events.IOnEventOptions

Reproduction Steps

Plug the snippet below into your .NET CDK project and run it to see the exception.

private static Pipeline CreateCiCdPipeline(Construct parent)
{
    const string appName = "My-Application";

    Artifact_ sourceCodeArtifact = new Artifact_("Visual-Studio-Solution");

    Vcs.Repository gitRepo = new Vcs.Repository(parent, "CodeCommitRepo",
        new Vcs.RepositoryProps
        {
            RepositoryName = "My-CodeCommit-Repo",
            Description = $"Version control system for {appName} application"
        }
    );

    var buildPipeline = new Pipeline(parent, "BuildPipeline",
        new PipelineProps
        {
            PipelineName = appName,
            Stages = new[]
            {
                new StageProps
                {
                    StageName = "Source",
                    Actions = new [] {
                        new CodeCommitSourceAction(new CodeCommitSourceActionProps
                        {
                            ActionName = "Git-checkout-from-CodeCommit-repo",
                            Repository = gitRepo,
                            Output = sourceCodeArtifact,
                            Branch = "master",
                        })
                    }
                }
            }
        }
    );

    return buildPipeline;
}

Error Log

Amazon.JSII.Runtime.JsiiException: Amazon.JSII.Runtime.JsiiException: Amazon.JSII.Runtime.JsiiException: System.InvalidCastException: Unable to cast Amazon.JSII.Runtime.Deputy.AnonymousObject into Amazon.CDK.AWS.Events.IOnEventOptions

Environment

  • **CLI Version :1.16.2 (build 5893301)
  • **Framework Version:3.0
  • **OS :Windows 10 Build 17763.805
  • **Language :C#

Other

Stack Trace

Amazon.JSII.Runtime.JsiiException: Amazon.JSII.Runtime.JsiiException: Amazon.JSII.Runtime.JsiiException: System.InvalidCastException: Unable to cast Amazon.JSII.Runtime.Deputy.AnonymousObject into Amazon.CDK.AWS.Events.IOnEventOptions
at Amazon.JSII.Runtime.Deputy.DeputyBase.ToType(Type conversionType, IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType)
at Amazon.JSII.Runtime.Services.Converters.JsiiToFrameworkConverter.TryConvertClass(Type type, IReferenceMap referenceMap, Object value, Object& result)
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.CallbackExtensions.<>c__DisplayClass2_0.b__0(Int32 n)
at System.Linq.Enumerable.SelectRangeIterator1.ToArray() at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)
at Amazon.JSII.Runtime.CallbackExtensions.InvokeMethod(InvokeRequest request, IReferenceMap referenceMap)
at Amazon.JSII.Runtime.CallbackExtensions.InvokeCallbackCore(Callback callback, IReferenceMap referenceMap)
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.ReceiveResponseTResponse
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponseTResponse
at Amazon.JSII.Runtime.Services.Client.Invoke(InvokeRequest request)
at Amazon.JSII.Runtime.Services.Client.Invoke(ObjectReference objectReference, String method, Object[] arguments)
at Amazon.JSII.Runtime.Deputy.DeputyBase.<>c__DisplayClass17_01.<InvokeInstanceMethod>b__1(IClient client, Object[] args) at Amazon.JSII.Runtime.Deputy.DeputyBase.<InvokeMethodCore>g__GetResult|18_0[T](<>c__DisplayClass18_01& )
at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeMethodCore[T](JsiiMethodAttribute methodAttribute, Object[] arguments, Func3 beginFunc, Func3 invokeFunc)
at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeInstanceMethod[T](Type[] parameterTypes, Object[] arguments, String methodName)
at Amazon.CDK.AWS.CodeCommit.Repository.OnCommit(String id, IOnCommitOptions options)
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponseTResponse
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponseTResponse
at Amazon.JSII.Runtime.Services.Client.Invoke(InvokeRequest request)
at Amazon.JSII.Runtime.Services.Client.Invoke(ObjectReference objectReference, String method, Object[] arguments)
at Amazon.JSII.Runtime.Deputy.DeputyBase.<>c__DisplayClass17_01.<InvokeInstanceMethod>b__1(IClient client, Object[] args) at Amazon.JSII.Runtime.Deputy.DeputyBase.<InvokeMethodCore>g__GetResult|18_0[T](<>c__DisplayClass18_01& )
at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeMethodCore[T](JsiiMethodAttribute methodAttribute, Object[] arguments, Func3 beginFunc, Func3 invokeFunc)
at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeInstanceMethod[T](Type[] parameterTypes, Object[] arguments, String methodName)
at Amazon.CDK.AWS.CodePipeline.Actions.CodeCommitSourceAction.Bound(Construct scope, IStage stage, IActionBindOptions options)
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponseTResponse
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponseTResponse
at Amazon.JSII.Runtime.Services.Client.Invoke(InvokeRequest request)
at Amazon.JSII.Runtime.Services.Client.Invoke(ObjectReference objectReference, String method, Object[] arguments)
at Amazon.JSII.Runtime.Deputy.DeputyBase.<>c__DisplayClass17_01.<InvokeInstanceMethod>b__1(IClient client, Object[] args) at Amazon.JSII.Runtime.Deputy.DeputyBase.<InvokeMethodCore>g__GetResult|18_0[T](<>c__DisplayClass18_01& )
at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeMethodCore[T](JsiiMethodAttribute methodAttribute, Object[] arguments, Func3 beginFunc, Func3 invokeFunc)
at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeInstanceMethod[T](Type[] parameterTypes, Object[] arguments, String methodName)
at Amazon.CDK.AWS.CodePipeline.Actions.Action.Bind(Construct scope, IStage stage, IActionBindOptions options)


This is 🐛 Bug Report

@vgribok vgribok added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 12, 2019
@SomayaB SomayaB added the language/dotnet Related to .NET bindings label Nov 12, 2019
@vgribok
Copy link
Author

vgribok commented Nov 12, 2019

Tested CDK v1.15.0 - no issue there. Looks like this bug was introduced in 1.16.xx.

@eladb eladb added the p0 label Nov 13, 2019
@eladb
Copy link
Contributor

eladb commented Nov 13, 2019

Thanks for reporting. Seems like it’s related to a regression we introduced in 1.16.x. Looking into it

@RomainMuller
Copy link
Contributor

Created an issue in jsii to track the fix aws/jsii#982 -- I'm working on a standard repro (aka compliance test) and fix.

RomainMuller added a commit that referenced this issue Nov 13, 2019
RomainMuller added a commit that referenced this issue Nov 13, 2019
1. Upgrades `jsii` to `0.20.5`(fixes #4989, fixes #4966, fixes #1904, fixes #1845)
2. Fixes the `ecs-patterns` library bug #4983
3. Fixes the CLI's "legacy" mode of operation bug #4998
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 needs-triage This issue or PR still needs to be triaged. p0
Projects
None yet
Development

No branches or pull requests

4 participants