Azure Function with MessageReceiver and .NET 5?

Viewed 276

I'm having problems trying to inject a MessageReceiver instance into my .NET 5 function like this:

[Function("MyFunction")
public void Run([ServiceBusTrigger("myqueue", Connection = "sbconn")] 
    MyMessage myMessage, FunctionContext context, MessageReceiver messageReceiver)

The error is:

Exception: Microsoft.Azure.Functions.Worker.Diagnostics.Exceptions.FunctionInputConverterException: Error converting 1 input parameters for Function 'MyFunction': Cannot convert input parameter 'messageReceiver' to type 'Microsoft.Azure.ServiceBus.Core.MessageReceiver' from type 'System.String'.

I have tried re-arranging the signature using various positions of messageReceiver but nothing works.

Also tried adding a string param where the runtime expects it to be as per the message above.. didn't work, error message still the same.

Has anybody managed to inject/resolve an instance of MessageReceiver with .NET 5 Functions?

Thanks

1 Answers
Related