Skip to content

Unable to debug with breakpoints in Azure Function app initialization code in Program.cs #1717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nlykkei opened this issue Jan 12, 2025 · 3 comments
Labels
area-dotnet-debugging Issues around .NET Debugging with console, ASP.NET, or Aspire bug Something isn't working enhancement New feature or request
Milestone

Comments

@nlykkei
Copy link

nlykkei commented Jan 12, 2025

Describe the Issue

I want to break add breakpoints in Azure Function app initialization code in Program.cs.

Consider the following code:

Image

This breakpoint is ignored in VS Code, but works fine in JetBrains Rider. In VS Code, breakpoints only works in function code, i.e. methods with the attribute [Function(nameof(MyFunction))].

Steps To Reproduce

Create a new Azure Function app project from a template, set a breakpoint in Program.cs, and run the project in debug mode (F5)

Expected Behavior

I expect that debugging breaks at the breakpoint in Program.cs

Environment Information

OS: MacOS (M3/arm64)
VS Code: 1.96.2
C# Dev Kit: 1.14.14

@nlykkei nlykkei added the bug Something isn't working label Jan 12, 2025
@WardenGnaw WardenGnaw added the area-dotnet-debugging Issues around .NET Debugging with console, ASP.NET, or Aspire label Jan 14, 2025
@WardenGnaw
Copy link
Member

This is related to microsoft/vscode-azurefunctions#1971

At the moment, the debugger works with the Functions CLI by attaching to the process which makes it support breakpoints too late.

There are plans in the backlog to support launching Az Functions instead of just attaching.

@WardenGnaw WardenGnaw added the enhancement New feature or request label Jan 15, 2025
@WardenGnaw WardenGnaw added this to the Backlog milestone Jan 15, 2025
@nlykkei
Copy link
Author

nlykkei commented Jan 18, 2025

Thank you. @WardenGnaw What do you mean by "Az Functions"? Do you mean the Functions CLI?

@golfalot
Copy link

Experiencing the same frustrations on Windows and Azure Functions 2.x .NET 8.0 isolated, on two different computers with all the updated tooling installed. func host start --dotnet-isolated-debug does not correct the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-dotnet-debugging Issues around .NET Debugging with console, ASP.NET, or Aspire bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants