How to Cannot bind parameter 'lockToken' in Azure Fucntion app in .net framework?

ashish fugat 11 Reputation points
2020-08-19T12:45:18.793+00:00

I was using .net core Azure function app no problem faced with the below code.

But when i create a azure function app using .net framework it is throwing below error kindly guide.

I tried all possible google solutions.

[FunctionName("Function1")]
        public static async System.Threading.Tasks.Task RunAsync([ServiceBusTrigger("topic", "sub", Connection = "ConnectionStringSettingName")]Message mySbMsg, string lockToken, MessageReceiver messageReceiver, ILogger log)
        {
            log.LogInformation($"C# ServiceBus topic trigger function processed message: {mySbMsg}");            
        }

error -

Error indexing method 'Function1.RunAsync'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'lockToken' to type Guid. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
544 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,248 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 25,661 Reputation points Microsoft Employee
    2020-08-20T04:38:32.157+00:00

    @ashish fugat my guess is that it's the difference between Functions 1.x which works with .NETFX and >2.x which works with .NETCORE, see here. For ServiceBus trigger, it's stated that 1.x should use BrokeredMessage where LockToken is of type Guid. For 2.x and later, Message should be used instead. However, I could not find LockToken property on that type. I would suggest posting a new issue on the azure webjobs sdk repo to see why the LockToken property was switched from Guid to string.

    0 comments No comments