DacronHeart
DacronHeart

Reputation: 75

remote debugging doesn't work for .NET 7 isolated and .NET 6 isolated Azure Function App from VS2022 (17.5.3)

I changed the Function App from .NET 6 in-process to .NET 7 isolated. Sometime after that the debugging stopped working, possibly after a VS update sometime last week.

The breakpoint turns into a hollow red circle with the following message: "The breakpoint will not be currently hit. No symbols have been loaded for this document" I can see the following error message in VS2022:(in the Output window - diagnostics hub) "The current version of VS Remote Tools does not match this version of Visual Studio. If errors occur, try installing the matching version of VS Remote Tools."

The issue is reproducible on a fresh default installation of the newest version of VS2022 and a new Azure Function App.

  1. set up an azure function app in the Azure portal
  2. select .NET for Runtime stack and '7 isolated' for Version, windows for Operating system
  3. Create a new project in VS2022 from the c# azure function template.
  4. select the .NET 7 isolated as a function worker
  5. publish the template code into the Function App in Azure.
  6. Attach the debugger.
  7. The breakpoints on the code just becomes empty red circles.

The same thing is happening if the Runtime stack /function worker is set to .NET 6 isolated. The debugging works if the Runtime stack/function worker is set to .NET 6 in-process

So currently I'm unable to work as I can't debug my Function App and there are things I can't emulate locally.

The local debugging works. The 'debug' code is published. The 'Just my code' is enabled The .pdb file is published correctly

Is something missing from the Azure function app templates/setup in isolated mode which prevents remote debugging? How can I make the debugging work?

Upvotes: 3

Views: 1967

Answers (1)

Harshitha
Harshitha

Reputation: 7297

"The current version of VS Remote Tools does not match this version of Visual Studio. If errors occur, try installing the matching version of VS Remote Tools."

In Visual Studio click on Install more tools and features.

enter image description here

  • Make sure you have selected the ASP.NET and web development and Azure development in the modify section.

enter image description here

  • Below options under Debugging and testing are checked by default.

enter image description here

Check the below steps to remote debug .NET 7 Isolated Function.

  • Create Azure Function .NET 7 Isolated .

  • Publish the Function App to Azure Windows App Service.

  • In Publish => Settings, Change the Configuration to Debug and click on Save and Publish the Function again.

enter image description here

  • Place the breakpoints in Function1.cs file.

  • Download the Publish profile to enter the credentials.

enter image description here

  • In VS => Debug => Attach to Process, enter the Connection target as the URL of the deployed Application with PORT no. 4024.

  • Select Show processes for all the users => select dotnet.exe and click on Attach

enter image description here

  • Enter the credentials from the downloaded publish profile and click ok.

enter image description here

  • All the breakpoints are loaded and seen in red color.

  • Navigate to the Published Azure Function => Functions => select the Function (Function1) => Code + Test => Get Function URL.

enter image description here

  • Run the URL in the browser.
  • You can see the breakpoint hit.

enter image description here

Upvotes: 2

Related Questions