Debugger not hiting debug point in visual studio 2019

Radhe Shyam Sah 1 Reputation point
2022-02-28T05:27:27.75+00:00

178344-image.png

I am willing to unable debug azure function(public static void Run([IoTHubTrigger("messages/events", Connection = "iotHubConnectionString",ConsumerGroup = "p04")]EventData message, ILogger log, ExecutionContext executionContext)) which is not hitting debug points, i have struck up with this

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Bruno Lucas 4,436 Reputation points MVP
    2022-02-28T09:42:12.4+00:00

    Hi, There could be a few things, like Firewall or connection string. what are you using to send messages to the hub? I used the add on for Visual Studio Code (https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-toolkit)

    Do you have the latest updates for Visual Studio 2019. that has happened to me and worked fine after the upgrade.

    According to this recent document (https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-iot-trigger?tabs=csharp) it is suggesting to use the azure event hub binding for IOT
    178397-image.png

    But I used the template from Visual Studio (as mentioned on this article: https://www.c-sharpcorner.com/article/iothubtrigger-azure-function-and-azure-iot-hub/) and seem to work

    The conn string for the trigger function (the one that goes in the local.settings.json )
    is this one here:

    178419-image.png

    **Debugging works fine. Received the message that I've sent **

    178478-image.png

    178466-image.png

    178436-image.png

    The only problem that i had initially is the firewall. I don't see the same error, but if it is not the connection string, try to shut down the firewall for a min only to test and confirm (https://youcandowithazure.blog/2022/02/27/code-and-test-azure-service-bus-and-azure-event-hub-triggers-locally/)
    178481-image.png

    0 comments No comments

  2. MughundhanRaveendran-MSFT 12,506 Reputation points
    2022-02-28T17:27:19.5+00:00

    @Radhe Shyam Sah ,

    Thanks for reaching out to Q&A.

    As you know, Azure functions are event based functions. The functions gets triggered based on events. Looking at the attached screenshot, you are running the functions in your local machine and host has started. You need to add/push an event to the IOT eventhub ( which you have configured in the connection string) so that the function gets triggered and the debugger will hit the debug point. Once you step over the the code, you will a message in the console called "Functions executing with invocation id".

    I hope this helps!

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.