Search code examples
azureazure-functionsvisual-studio-2022remote-debugging

Remote debugging an azure function's Startup in VS 2022


I have this error in my function's app Error configuring services in an external startup class.

I started a remote debugging session successfully using this guide, and is working. The thing is everytime I re-start the app in the portal, the connection gets lost, so I am unable to reach a desired point in a Configuration method.

Is there any way to debug a startup method?


Solution

  • Yes, you can debug a startup method. by using the Snapshot Debugger feature in Azure Functions.

    enter image description here

    Attaching the Snapshot Debugger.

    enter image description here

    Keep the debugger point where you need to debug. Add condition based on your requirement as shown below.

    enter image description here

    Once the debug is done you will be able to view the snapshot.

    enter image description here

    For more information, refer to Snapshot-debugger-function-app.