Describe the bug
Calling testKey.GrantEncryptDecrypt(new Anyone()); throws System.Reflection.TargetParameterCountException: Parameter count mismatch.
on the GrantEncryptDecrypt or any Grant part
To Reproduce
````
var testKey = new EncryptionKey(this, "key", new EncryptionKeyProps
{
Description = "test key",
EnableKeyRotation = false,
Enabled = true,
Retain = false
});
testKey.GrantEncryptDecrypt(new Anyone());
````
Expected behavior
The grant to happen, worked in 0.28
Version:
I'm having the same error message when trying to add a SqsEventSource. v0.31
Having save error when trying to addContainer to taskDefinition
Was able to repro using:
var testKey = new Key(stack, "key", new KeyProps()
{
Description = "test key",
EnableKeyRotation = false,
Enabled = true,
});
testKey.GrantEncryptDecrypt(new Anyone());
After some investigation:
relates https://github.com/aws/jsii/issues/404
When deserializing callback arguments, the wrong number of arguments get passed to the callback method here:
In the above GrantEncryptDecrypt() example, a callback to Grant() is created, with 5 arguments. The first is an IIGrantable and the other fives are strings. They should have been casted as an array of string[]
The signature for Grant() is:
Grant(IIGrantable grantee, params string[] actions)
Hence the blow up.
Original root cause:
I am lacking background on the matter. Any idea @RomainMuller ?
Hitting this issue as well
This might be fixed in the next version.
This should be fixed on the current release!