From ca2d605f15223a08827edbafb3caf0a8d3f1246c Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 17 Jun 2022 08:47:06 -0400 Subject: [PATCH] Fixed "typo" by using replacement of typeof().FullName --- .../Bootstrap/InvokeDelegateBuilder.cs | 4 ++-- .../Amazon.Lambda.RuntimeSupport/ExceptionHandling/Errors.cs | 4 ++-- .../Amazon.Lambda.RuntimeSupport.UnitTests/HandlerTests.cs | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/InvokeDelegateBuilder.cs b/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/InvokeDelegateBuilder.cs index e593f2b7c..c3e5b3308 100644 --- a/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/InvokeDelegateBuilder.cs +++ b/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/InvokeDelegateBuilder.cs @@ -320,7 +320,7 @@ private Expression CreateSerializeExpression(object customerSerializerInstance, if (customerSerializerInstance == null) { throw LambdaExceptions.ValidationException(Errors.UserCodeLoader.SerializeMissingAttribute, - _handler.AssemblyName, _handler.MethodName, dataType.FullName); + _handler.AssemblyName, _handler.MethodName, dataType.FullName, typeof(LambdaSerializerAttribute).FullName); } iLambdaSerializerType = customerSerializerInstance @@ -372,7 +372,7 @@ private Expression CreateDeserializeExpression(object customerSerializerInstance if (customerSerializerInstance == null) { throw LambdaExceptions.ValidationException(Errors.UserCodeLoader.DeserializeMissingAttribute, - _handler.AssemblyName, _handler.MethodName, dataType.FullName); + _handler.AssemblyName, _handler.MethodName, dataType.FullName, typeof(LambdaSerializerAttribute).FullName); } genericTypes = new[] {dataType}; diff --git a/Libraries/src/Amazon.Lambda.RuntimeSupport/ExceptionHandling/Errors.cs b/Libraries/src/Amazon.Lambda.RuntimeSupport/ExceptionHandling/Errors.cs index 3f1d03dfe..d3a4ead1f 100644 --- a/Libraries/src/Amazon.Lambda.RuntimeSupport/ExceptionHandling/Errors.cs +++ b/Libraries/src/Amazon.Lambda.RuntimeSupport/ExceptionHandling/Errors.cs @@ -32,8 +32,8 @@ internal static class Internal public const string CouldNotFindHandlerAssembly = "Could not find the specified handler assembly with the file name '{0}'. The assembly should be located in the root of your uploaded .zip file."; public const string UnableToLoadAssembly = "Unable to load assembly '{0}'."; public const string UnableToLoadType = "Unable to load type '{0}' from assembly '{1}'."; - public const string DeserializeMissingAttribute = "Could not find the LambdaSerializerAttribute on the assembly '{0}' or method '{1}' while attempting to deserialize input data of type '{2}'. To use types other than System.IO.Stream as input/output parameters, the assembly or Lambda function should be annotated with Amazon.Lambda.LambdaSerializerAttribute."; - public const string SerializeMissingAttribute = "Could not find the LambdaSerializerAttribute on the assembly '{0}' or method '{1}' while attempting to serialize output data of type '{2}'. To use types other than System.IO.Stream as input/output parameters, the assembly or Lambda function should be annotated with Amazon.Lambda.LambdaSerializerAttribute."; + public const string DeserializeMissingAttribute = "Could not find the LambdaSerializerAttribute on the assembly '{0}' or method '{1}' while attempting to deserialize input data of type '{2}'. To use types other than System.IO.Stream as input/output parameters, the assembly or Lambda function should be annotated with {3}."; + public const string SerializeMissingAttribute = "Could not find the LambdaSerializerAttribute on the assembly '{0}' or method '{1}' while attempting to serialize output data of type '{2}'. To use types other than System.IO.Stream as input/output parameters, the assembly or Lambda function should be annotated with {3}."; public const string MethodTooManyParams = "Method '{0}' of type '{1}' is not supported: the method has more than 2 parameters."; public const string MethodSecondParamNotContext = "Method '{0}' of type '{1}' is not supported: the method has 2 parameters, but the second parameter is not of type '{2}'."; public const string NoMatchingMethod = "Unable to find method '{0}' in type '{1}' from assembly '{2}': Found no methods matching method name '{3}'."; diff --git a/Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.UnitTests/HandlerTests.cs b/Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.UnitTests/HandlerTests.cs index c782b85a7..67881b443 100644 --- a/Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.UnitTests/HandlerTests.cs +++ b/Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.UnitTests/HandlerTests.cs @@ -21,6 +21,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +using Amazon.Lambda.Core; using Amazon.Lambda.RuntimeSupport.Bootstrap; using Amazon.Lambda.RuntimeSupport.ExceptionHandling; using Amazon.Lambda.RuntimeSupport.Helpers; @@ -149,8 +150,8 @@ public async Task NegativeBootstrapInitTestsAsync() await TestHandlerFailAsync("HandlerTest::HandlerTest.CustomerType::TwoInputsNoContextMethod", "is not supported: the method has 2 parameters, but the second parameter is not of type"); await TestHandlerFailAsync("HandlerTest::HandlerTest.CustomerType::TooManyInputsMethod", "is not supported: the method has more than 2 parameters."); - await TestHandlerFailAsync("HandlerTestNoSerializer::HandlerTestNoSerializer.CustomerType::PocoInPocoOut", "To use types other than System.IO.Stream as input/output parameters, the assembly or Lambda function should be annotated with Amazon.Lambda.LambdaSerializerAttribute."); - await TestHandlerFailAsync("HandlerTestNoSerializer::HandlerTestNoSerializer.CustomerType::PocoInPocoOut", "To use types other than System.IO.Stream as input/output parameters, the assembly or Lambda function should be annotated with Amazon.Lambda.LambdaSerializerAttribute."); + await TestHandlerFailAsync("HandlerTestNoSerializer::HandlerTestNoSerializer.CustomerType::PocoInPocoOut", $"To use types other than System.IO.Stream as input/output parameters, the assembly or Lambda function should be annotated with {typeof(LambdaSerializerAttribute).FullName}."); + await TestHandlerFailAsync("HandlerTestNoSerializer::HandlerTestNoSerializer.CustomerType::PocoInPocoOut", $"To use types other than System.IO.Stream as input/output parameters, the assembly or Lambda function should be annotated with {typeof(LambdaSerializerAttribute).FullName}."); var noZeroParamTypeEx = await TestHandlerFailAsync("HandlerTest::HandlerTest.NoZeroParamConstructorCustomerType::SimpleMethod", "No parameterless constructor defined"); Assert.IsAssignableFrom(noZeroParamTypeEx);