Azure / azure-functions-dotnet-worker

Azure Functions out-of-process .NET language worker
MIT License
431 stars 184 forks source link

When using Isolated worker model in AZ Func, with ServiceBusTrigger and BlobInput, the underlying system throws deserialization failures. #2858

Closed JoshLove-msft closed 2 days ago

JoshLove-msft commented 3 days ago

Issue Transfer

This issue has been transferred from the Azure SDK for .NET repository, #46941.

Please be aware that @BootsShu is the author of the original issue and include them for any questions or replies.

Details

Library name and version

Azure.Messaging.ServiceBus 7.18.1

Describe the bug

When using Isolated worker model in AZ Func, with ServiceBusTrigger and BlobInput, the underlying system throws deserialization failures.

Codes:

public class DistributeBusinessPartner
{
    private readonly ILogger<DistributeBusinessPartner> _logger;
    public DistributeBusinessPartner(ILogger<DistributeBusinessPartner> logger)
    {
        _logger = logger;
    }

    [Function(nameof(DistributeBusinessPartner))]
    [ServiceBusOutput("q.name2", Connection = "send")]
    public static async Task<ServiceBusMessage> Run(
        [ServiceBusTrigger("q.name", Connection = "receive")] ServiceBusReceivedMessage messageIn,
        [BlobInput("payloads/inbound/{CorrelationId}", Connection = "payloadStorage")] string payloadIn,
        FunctionContext executionContext
        )
    {
        return new ServiceBusMessage() { CorrelationId = Guid.NewGuid().ToString() };
    }
}

Stack error info:

[2024-10-25T07:29:44.992Z] Function 'DistributeBusinessPartner', Invocation id '432f7c11-61ce-43f5-95f2-bbf0001bcadd': An exception was thrown by the invocation.
[2024-10-25T07:29:44.997Z] Result: Function 'DistributeBusinessPartner', Invocation id '432f7c11-61ce-43f5-95f2-bbf0001bcadd': An exception was thrown by the invocation.
Exception: Microsoft.Azure.Functions.Worker.FunctionInputConverterException: Error converting 1 input parameters for Function 'DistributeBusinessPartner': Cannot convert input parameter 'messageIn' to type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage' from type 'System.String'. Error:System.NotSupportedException: Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported. Type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage'. Path: $ | LineNumber: 0 | BytePositionInLine: 1.
[2024-10-25T07:29:45.000Z] ---> System.NotSupportedException: Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported. Type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage'.
[2024-10-25T07:29:45.001Z] --- End of inner exception stack trace ---
[2024-10-25T07:29:45.003Z] at System.Text.Json.ThrowHelper.ThrowNotSupportedException(ReadStack& state, Utf8JsonReader& reader, NotSupportedException ex)
[2024-10-25T07:29:45.005Z] at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) [2024-10-25T07:29:45.007Z]    at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
[2024-10-25T07:29:45.009Z] at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) [2024-10-25T07:29:45.013Z]    at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.ContinueDeserialize(ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack)
[2024-10-25T07:29:45.016Z] at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.DeserializeAsync(Stream utf8Json, CancellationToken cancellationToken) [2024-10-25T07:29:45.019Z]    at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.DeserializeAsObjectAsync(Stream utf8Json, CancellationToken cancellationToken)
[2024-10-25T07:29:45.021Z] at Microsoft.Azure.Functions.Worker.Converters.JsonPocoConverter.GetConversionResultFromDeserialization(Byte[] bytes, Type type) in D:\a_work\1\s\src\DotNetWorker.Core\Converters\JsonPocoConverter.cs:line 66
[2024-10-25T07:29:45.024Z] at Microsoft.Azure.Functions.Worker.Context.Features.DefaultFunctionInputBindingFeature.BindFunctionInputAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\Context\Features\DefaultFunctionInputBindingFeature.cs:line 97
[2024-10-25T07:29:45.030Z] at Functions.China.eVA.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\Users\esbDevUser\Desktop\ESB.CN\Functions.China.eVA\Functions.China.eVA\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 33
[2024-10-25T07:29:45.033Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13
[2024-10-25T07:29:45.035Z] at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 91
Stack: at Microsoft.Azure.Functions.Worker.Context.Features.DefaultFunctionInputBindingFeature.BindFunctionInputAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\Context\Features\DefaultFunctionInputBindingFeature.cs:line 97
[2024-10-25T07:29:45.038Z] at Functions.China.eVA.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\Users\esbDevUser\Desktop\ESB.CN\Functions.China.eVA\Functions.China.eVA\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 33
[2024-10-25T07:29:45.045Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13
[2024-10-25T07:29:45.058Z] at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 91.
[2024-10-25T07:29:45.063Z] Executed 'Functions.DistributeBusinessPartner' (Failed, Id=432f7c11-61ce-43f5-95f2-bbf0001bcadd, Duration=437ms)
[2024-10-25T07:29:45.065Z] System.Private.CoreLib: Exception while executing function: Functions.DistributeBusinessPartner. System.Private.CoreLib: Result: Failure
Exception: Microsoft.Azure.Functions.Worker.FunctionInputConverterException: Error converting 1 input parameters for Function 'DistributeBusinessPartner': Cannot convert input parameter 'messageIn' to type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage' from type 'System.String'. Error:System.NotSupportedException: Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported. Type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage'. Path: $ | LineNumber: 0 | BytePositionInLine: 1.
[2024-10-25T07:29:45.068Z] ---> System.NotSupportedException: Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported. Type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage'.
[2024-10-25T07:29:45.070Z] --- End of inner exception stack trace ---
[2024-10-25T07:29:45.086Z] at System.Text.Json.ThrowHelper.ThrowNotSupportedException(ReadStack& state, Utf8JsonReader& reader, NotSupportedException ex)
[2024-10-25T07:29:45.089Z] at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) [2024-10-25T07:29:45.092Z]    at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
[2024-10-25T07:29:45.094Z] at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) [2024-10-25T07:29:45.096Z]    at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.ContinueDeserialize(ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack)
[2024-10-25T07:29:45.098Z] at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.DeserializeAsync(Stream utf8Json, CancellationToken cancellationToken) [2024-10-25T07:29:45.101Z]    at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.DeserializeAsObjectAsync(Stream utf8Json, CancellationToken cancellationToken)
[2024-10-25T07:29:45.102Z] at Microsoft.Azure.Functions.Worker.Converters.JsonPocoConverter.GetConversionResultFromDeserialization(Byte[] bytes, Type type) in D:\a_work\1\s\src\DotNetWorker.Core\Converters\JsonPocoConverter.cs:line 66
[2024-10-25T07:29:45.107Z] at Microsoft.Azure.Functions.Worker.Context.Features.DefaultFunctionInputBindingFeature.BindFunctionInputAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\Context\Features\DefaultFunctionInputBindingFeature.cs:line 97
[2024-10-25T07:29:45.109Z] at Functions.China.eVA.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\Users\esbDevUser\Desktop\ESB.CN\Functions.China.eVA\Functions.China.eVA\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 33
[2024-10-25T07:29:45.111Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13
[2024-10-25T07:29:45.114Z] at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 91
[2024-10-25T07:29:45.116Z] at Microsoft.Azure.Functions.Worker.Handlers.InvocationHandler.InvokeAsync(InvocationRequest request) in D:\a_work\1\s\src\DotNetWorker.Grpc\Handlers\InvocationHandler.cs:line 88
Stack: at Microsoft.Azure.Functions.Worker.Context.Features.DefaultFunctionInputBindingFeature.BindFunctionInputAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\Context\Features\DefaultFunctionInputBindingFeature.cs:line 97
[2024-10-25T07:29:45.118Z] at Functions.China.eVA.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\Users\esbDevUser\Desktop\ESB.CN\Functions.China.eVA\Functions.China.eVA\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 33
[2024-10-25T07:29:45.122Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13
[2024-10-25T07:29:45.124Z] at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 91
[2024-10-25T07:29:45.125Z] at Microsoft.Azure.Functions.Worker.Handlers.InvocationHandler.InvokeAsync(InvocationRequest request) in D:\a_work\1\s\src\DotNetWorker.Grpc\Handlers\InvocationHandler.cs:line 88.
[2024-10-25T07:29:45.130Z] q.china.eva.businesspartner.storage-90445141-bbae-4e8c-863d-1a8d78516df8: User message handler complete: Message: SequenceNumber: 28, Exception: Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.DistributeBusinessPartner
[2024-10-25T07:29:45.132Z] ---> Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException: Result: Failure
Exception: Microsoft.Azure.Functions.Worker.FunctionInputConverterException: Error converting 1 input parameters for Function 'DistributeBusinessPartner': Cannot convert input parameter 'messageIn' to type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage' from type 'System.String'. Error:System.NotSupportedException: Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported. Type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage'. Path: $ | LineNumber: 0 | BytePositionInLine: 1.
[2024-10-25T07:29:45.137Z] ---> System.NotSupportedException: Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported. Type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage'.
[2024-10-25T07:29:45.139Z] --- End of inner exception stack trace ---
[2024-10-25T07:29:45.140Z] at System.Text.Json.ThrowHelper.ThrowNotSupportedException(ReadStack& state, Utf8JsonReader& reader, NotSupportedException ex)
[2024-10-25T07:29:45.142Z] at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) [2024-10-25T07:29:45.144Z]    at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
[2024-10-25T07:29:45.145Z] at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) [2024-10-25T07:29:45.147Z]    at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.ContinueDeserialize(ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack)
[2024-10-25T07:29:45.149Z] at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.DeserializeAsync(Stream utf8Json, CancellationToken cancellationToken) [2024-10-25T07:29:45.159Z]    at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.DeserializeAsObjectAsync(Stream utf8Json, CancellationToken cancellationToken)
[2024-10-25T07:29:45.162Z] at Microsoft.Azure.Functions.Worker.Converters.JsonPocoConverter.GetConversionResultFromDeserialization(Byte[] bytes, Type type) in D:\a_work\1\s\src\DotNetWorker.Core\Converters\JsonPocoConverter.cs:line 66
[2024-10-25T07:29:45.164Z] at Microsoft.Azure.Functions.Worker.Context.Features.DefaultFunctionInputBindingFeature.BindFunctionInputAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\Context\Features\DefaultFunctionInputBindingFeature.cs:line 97
[2024-10-25T07:29:45.178Z] at Functions.China.eVA.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\Users\esbDevUser\Desktop\ESB.CN\Functions.China.eVA\Functions.China.eVA\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 33
[2024-10-25T07:29:45.180Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13
[2024-10-25T07:29:45.184Z] at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 91
[2024-10-25T07:29:45.186Z] at Microsoft.Azure.Functions.Worker.Handlers.InvocationHandler.InvokeAsync(InvocationRequest request) in D:\a_work\1\s\src\DotNetWorker.Grpc\Handlers\InvocationHandler.cs:line 88
Stack: at Microsoft.Azure.Functions.Worker.Context.Features.DefaultFunctionInputBindingFeature.BindFunctionInputAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\Context\Features\DefaultFunctionInputBindingFeature.cs:line 97
[2024-10-25T07:29:45.188Z] at Functions.China.eVA.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\Users\esbDevUser\Desktop\ESB.CN\Functions.China.eVA\Functions.China.eVA\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 33
[2024-10-25T07:29:45.191Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13
[2024-10-25T07:29:45.193Z] at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 91
[2024-10-25T07:29:45.195Z] at Microsoft.Azure.Functions.Worker.Handlers.InvocationHandler.InvokeAsync(InvocationRequest request) in D:\a_work\1\s\src\DotNetWorker.Grpc\Handlers\InvocationHandler.cs:line 88
[2024-10-25T07:29:45.216Z] at Microsoft.Azure.WebJobs.Script.Description.WorkerFunctionInvoker.InvokeCore(Object[] parameters, FunctionInvocationContext context) in //src/WebJobs.Script/Description/Workers/WorkerFunctionInvoker.cs:line 101
[2024-10-25T07:29:45.218Z] at Microsoft.Azure.WebJobs.Script.Description.FunctionInvokerBase.Invoke(Object[] parameters) in //src/WebJobs.Script/Description/FunctionInvokerBase.cs:line 82
[2024-10-25T07:29:45.220Z] at Microsoft.Azure.WebJobs.Host.Executors.VoidTaskMethodInvoker2.InvokeAsync(TReflected instance, Object[] arguments) in D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\VoidTaskMethodInvoker.cs:line 20 [2024-10-25T07:29:45.221Z]    at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker2.InvokeAsync(Object instance, Object[] arguments) in D:\a_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs:line 53
[2024-10-25T07:29:45.223Z] at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeWithTimeoutAsync(IFunctionInvoker invoker, ParameterHelper parameterHelper, CancellationTokenSource timeoutTokenSource, CancellationTokenSource functionCancellationTokenSource, Boolean throwOnTimeout, TimeSpan timerInterval, IFunctionInstance instance) in D:\a_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 581
[2024-10-25T07:29:45.225Z] at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstanceEx instance, ParameterHelper parameterHelper, ILogger logger, CancellationTokenSource functionCancellationTokenSource) in D:\a_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 527
[2024-10-25T07:29:45.227Z] at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance, FunctionStartedMessage message, FunctionInstanceLogEntry instanceLogEntry, ParameterHelper parameterHelper, ILogger logger, CancellationToken cancellationToken) in D:\a_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 306
[2024-10-25T07:29:45.243Z] --- End of inner exception stack trace ---
[2024-10-25T07:29:45.246Z] at Microsoft.Azure.WebJobs.ServiceBus.MessageProcessor.CompleteProcessingMessageAsync(ServiceBusMessageActions actions, ServiceBusReceivedMessage message, FunctionResult result, CancellationToken cancellationToken)
[2024-10-25T07:29:45.248Z] at Microsoft.Azure.WebJobs.ServiceBus.Listeners.ServiceBusListener.ProcessMessageAsync(ProcessMessageEventArgs args)
[2024-10-25T07:29:45.250Z] at Azure.Messaging.ServiceBus.ServiceBusProcessor.OnProcessMessageAsync(ProcessMessageEventArgs args)
[2024-10-25T07:29:45.253Z] at Azure.Messaging.ServiceBus.ReceiverManager.OnMessageHandler(EventArgs args)
[2024-10-25T07:29:45.255Z] at Azure.Messaging.ServiceBus.ReceiverManager.ProcessOneMessage(ServiceBusReceivedMessage triggerMessage, CancellationToken cancellationToken), LockToken: 34babbe3-3145-4349-adbf-946fe947f5d8
[2024-10-25T07:29:45.262Z] Message processing error (Action=ProcessMessageCallback, EntityPath=q.china.eva.businesspartner.storage, Endpoint=cz-esb-sb-sha-d.servicebus.chinacloudapi.cn)
[2024-10-25T07:29:45.266Z] System.Private.CoreLib: Exception while executing function: Functions.DistributeBusinessPartner. System.Private.CoreLib: Result: Failure
Exception: Microsoft.Azure.Functions.Worker.FunctionInputConverterException: Error converting 1 input parameters for Function 'DistributeBusinessPartner': Cannot convert input parameter 'messageIn' to type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage' from type 'System.String'. Error:System.NotSupportedException: Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported. Type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage'. Path: $ | LineNumber: 0 | BytePositionInLine: 1.
[2024-10-25T07:29:45.269Z] ---> System.NotSupportedException: Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported. Type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage'.
[2024-10-25T07:29:45.271Z] --- End of inner exception stack trace ---
[2024-10-25T07:29:45.272Z] at System.Text.Json.ThrowHelper.ThrowNotSupportedException(ReadStack& state, Utf8JsonReader& reader, NotSupportedException ex)
[2024-10-25T07:29:45.274Z] at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) [2024-10-25T07:29:45.278Z]    at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
[2024-10-25T07:29:45.280Z] at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) [2024-10-25T07:29:45.282Z]    at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.ContinueDeserialize(ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack)
[2024-10-25T07:29:45.284Z] at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.DeserializeAsync(Stream utf8Json, CancellationToken cancellationToken) [2024-10-25T07:29:45.286Z]    at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.DeserializeAsObjectAsync(Stream utf8Json, CancellationToken cancellationToken)
[2024-10-25T07:29:45.288Z] at Microsoft.Azure.Functions.Worker.Converters.JsonPocoConverter.GetConversionResultFromDeserialization(Byte[] bytes, Type type) in D:\a_work\1\s\src\DotNetWorker.Core\Converters\JsonPocoConverter.cs:line 66
[2024-10-25T07:29:45.290Z] at Microsoft.Azure.Functions.Worker.Context.Features.DefaultFunctionInputBindingFeature.BindFunctionInputAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\Context\Features\DefaultFunctionInputBindingFeature.cs:line 97
[2024-10-25T07:29:45.308Z] at Functions.China.eVA.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\Users\esbDevUser\Desktop\ESB.CN\Functions.China.eVA\Functions.China.eVA\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 33
[2024-10-25T07:29:45.310Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13
[2024-10-25T07:29:45.312Z] at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 91
[2024-10-25T07:29:45.314Z] at Microsoft.Azure.Functions.Worker.Handlers.InvocationHandler.InvokeAsync(InvocationRequest request) in D:\a_work\1\s\src\DotNetWorker.Grpc\Handlers\InvocationHandler.cs:line 88
Stack: at Microsoft.Azure.Functions.Worker.Context.Features.DefaultFunctionInputBindingFeature.BindFunctionInputAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\Context\Features\DefaultFunctionInputBindingFeature.cs:line 97
[2024-10-25T07:29:45.316Z] at Functions.China.eVA.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\Users\esbDevUser\Desktop\ESB.CN\Functions.China.eVA\Functions.China.eVA\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 33
[2024-10-25T07:29:45.318Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13

Provide a demo project for reproduction. Please refer to the attachment for details. Thank you!

[Functions.China.eVA.zip](https://github.com/user-attachments/files/17595368/Functions.China.eVA.zip)

Expected behavior

When entering the function, the value of ServiceBusReceptdMessage can be obtained.

Actual behavior

The current situation is that it is impossible to enter the function and a deserialization error occurs, specifically: Cannot convert input parameter 'messageIn' to type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage' from type 'System.String'.

Reproduction Steps

Please see the attachment to reproduce the incident scene.

Environment

Envs: NET 8.0 Az Function Isolated v4.0

Packages:

<PackageReference Include="Microsoft.Azure.Core.NewtonsoftJson" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.1.7" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" Version="5.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs" Version="6.6.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Queues" Version="5.5.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Tables" Version="1.4.2" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.18.1" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
BootsShu commented 3 days ago

Thank you all for your attention and support. We look forward to resolving this issue successfully and making our code even more refined and elegant.

jviau commented 2 days ago

Duplicate of #2815