diff --git a/fetch-dotnet-snk.sh b/fetch-dotnet-snk.sh index 99312ecb31..ce4dc28ebf 100644 --- a/fetch-dotnet-snk.sh +++ b/fetch-dotnet-snk.sh @@ -11,7 +11,7 @@ function echo_usage() { echo -e "\tDOTNET_STRONG_NAME_SECRET_ID=" } -if [ -z ${DOTNET_STRONG_NAME_ENABLED:-} ]; then +if [ -z "${DOTNET_STRONG_NAME_ENABLED:-}" ]; then echo "Environment variable DOTNET_STRONG_NAME_ENABLED is not set. Skipping strong-name signing." exit 0 fi @@ -21,19 +21,19 @@ echo "Retrieving SNK..." apt update -y apt install jq -y -if [ -z ${DOTNET_STRONG_NAME_ROLE_ARN:-} ]; then +if [ -z "${DOTNET_STRONG_NAME_ROLE_ARN:-}" ]; then echo "Strong name signing is enabled, but DOTNET_STRONG_NAME_ROLE_ARN is not set." echo_usage exit 1 fi -if [ -z ${DOTNET_STRONG_NAME_SECRET_REGION:-}]; then +if [ -z "${DOTNET_STRONG_NAME_SECRET_REGION:-}" ]; then echo "Strong name signing is enabled, but DOTNET_STRONG_NAME_SECRET_REGION is not set." echo_usage exit 1 fi -if [ -z ${DOTNET_STRONG_NAME_SECRET_ID:-} ]; then +if [ -z "${DOTNET_STRONG_NAME_SECRET_ID:-}" ]; then echo "Strong name signing is enabled, but DOTNET_STRONG_NAME_SECRET_ID is not set." echo_usage exit 1 diff --git a/packages/jsii-dotnet-jsonmodel/src/Amazon.JSII.JsonModel/Api/Request/CompleteRequest.cs b/packages/jsii-dotnet-jsonmodel/src/Amazon.JSII.JsonModel/Api/Request/CompleteRequest.cs index 78bd3c4878..f9b13eb149 100644 --- a/packages/jsii-dotnet-jsonmodel/src/Amazon.JSII.JsonModel/Api/Request/CompleteRequest.cs +++ b/packages/jsii-dotnet-jsonmodel/src/Amazon.JSII.JsonModel/Api/Request/CompleteRequest.cs @@ -19,10 +19,10 @@ public CompleteRequest(string callbackId, string error = null, object result = n [JsonProperty("cbid")] public string CallbackId { get; } - [JsonProperty("error", NullValueHandling = NullValueHandling.Ignore)] + [JsonProperty("err", NullValueHandling = NullValueHandling.Ignore)] public string Error { get; } [JsonProperty("result", NullValueHandling = NullValueHandling.Ignore)] public object Result { get; } } -} \ No newline at end of file +} diff --git a/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs b/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs index c8f176986f..9b287e9483 100644 --- a/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs +++ b/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs @@ -462,8 +462,8 @@ public void AsyncOverrides_OverrideThrows() { AsyncVirtualMethodsChild obj = new AsyncVirtualMethodsChild(); - RuntimeException exception = Assert.Throws(() => obj.CallMe()); - Assert.Equal("Thrown by native code", exception.Message); + JsiiException exception = Assert.Throws(() => obj.CallMe()); + Assert.Contains("Thrown by native code", exception.Message); } class SyncVirtualMethodsChild_Set_CallsSuper : SyncVirtualMethods @@ -531,8 +531,8 @@ public void PropertyOverrides_Get_Throws() { SyncVirtualMethodsChild_Throws so = new SyncVirtualMethodsChild_Throws(); - RuntimeException exception = Assert.Throws(() => so.RetrieveValueOfTheProperty()); - Assert.Equal("Oh no, this is bad", exception.Message); + JsiiException exception = Assert.Throws(() => so.RetrieveValueOfTheProperty()); + Assert.Contains("Oh no, this is bad", exception.Message); } [Fact(DisplayName = Prefix + nameof(PropertyOverrides_Set_CallsSuper))] @@ -549,8 +549,8 @@ public void PropertyOverrides_Set_Throws() { SyncVirtualMethodsChild_Throws so = new SyncVirtualMethodsChild_Throws(); - RuntimeException exception = Assert.Throws(() => so.ModifyValueOfTheProperty("Hii")); - Assert.Equal("Exception from overloaded setter", exception.Message); + JsiiException exception = Assert.Throws(() => so.ModifyValueOfTheProperty("Hii")); + Assert.Contains("Exception from overloaded setter", exception.Message); } [Fact(DisplayName = Prefix + nameof(PropertyOverrides_Interfaces))] diff --git a/packages/jsii-dotnet-runtime/src/Amazon.JSII.Runtime/CallbackExtensions.cs b/packages/jsii-dotnet-runtime/src/Amazon.JSII.Runtime/CallbackExtensions.cs index 6a9429abb1..ca1c259831 100644 --- a/packages/jsii-dotnet-runtime/src/Amazon.JSII.Runtime/CallbackExtensions.cs +++ b/packages/jsii-dotnet-runtime/src/Amazon.JSII.Runtime/CallbackExtensions.cs @@ -29,14 +29,13 @@ public static object InvokeCallback(this Callback callback, IReferenceMap refere } catch (TargetInvocationException e) { - throw e.InnerException; - } - catch (TargetParameterCountException) - { - throw; + // An exception was thrown by the method being invoked + error = e.InnerException.ToString(); + return null; } catch (Exception e) { + // An exception was thrown while preparing the request or processing the result error = e.ToString(); return null; } diff --git a/packages/jsii-dotnet-runtime/src/Amazon.JSII.Runtime/Deputy/DeputyBase.cs b/packages/jsii-dotnet-runtime/src/Amazon.JSII.Runtime/Deputy/DeputyBase.cs index 3f94244088..c315018125 100644 --- a/packages/jsii-dotnet-runtime/src/Amazon.JSII.Runtime/Deputy/DeputyBase.cs +++ b/packages/jsii-dotnet-runtime/src/Amazon.JSII.Runtime/Deputy/DeputyBase.cs @@ -251,7 +251,7 @@ protected T InvokeInstanceMethod(object[] arguments, [CallerMemberName] strin ) { IServiceProvider serviceProvider = ServiceContainer.ServiceProvider; - IClient client = serviceProvider.GetRequiredService(); ; + IClient client = serviceProvider.GetRequiredService(); IJsiiToFrameworkConverter converter = serviceProvider.GetRequiredService(); IReferenceMap referenceMap = serviceProvider.GetRequiredService();