-
Notifications
You must be signed in to change notification settings - Fork 138
Debugger attaching too late - Unable to hit breakpoints in Startup.cs #1971
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
Comments
Yeah this is somewhat of a known issue. Similar issues for other languages:
We're currently blocked on this: Azure/azure-functions-host#4384 |
this happens for my consistently
vscode
core tools
c#
azure functions extension
|
This issue has become stale and is at risk of being closed. The community has 60 days to upvote the issue. If it receives 5 upvotes we will keep it open and take another look. If not, we will close it. To learn more about how we handle issues, please see our documentation.\n\nHappy Coding! |
I am facing the same issue ! |
Same here, has anyone found a fix for this? |
I am also facing same issue. |
@ejizba Hello, this is just a gentle reminder but is there any plan for fixing this issue? Thank you very much for the confirmation! |
Same. Any update? |
I've been running in circles trying to figure this out. I'm on a Mac so I don't have an option to use Visual Studio. Anyone found a workaround to hit the breakpoints with VS Code? Adding in Thread.Sleep() didn't seem to help me either. |
Hi, sorry for the delayed response. My understanding is that this PR (#2200) should have fixed this problem, but I can see that it hasn't completely 😞 What version of the Func Core Tools and Functions Extension are you using? Does the debugger just miss the breakpoint for the first time and then successfully works after that? Or does it never even attach? |
Func Core Tools: 3.0.3477 The debugger will not break on startup.cs. It will attach on HTTP requests to the functions themselves. Just not on startup.cs while the app starts. |
Thanks for your quick response! This sounds like it might be a timing issue between when VS Code actually attaches vs. when the process starts. This might be tricky to resolve due to the fact that we are using attach requests for debugging.
Since the process is required to be running before VS Code can attach, it's most likely missing anything in the Perhaps current workarounds are hard-coding a lengthy delay before the breakpoint or configuring the task itself to launch the process. |
For info, I can debug Startup.cs with this configuration in launch.json
|
Neither with no delay, or with long delay. I can't get the breakpoints in the configure code to hit. |
For .NET 8 isolated, starting with
vid.webm |
In some situations, it looks like the VS Code debugger is unable to attach fast enough to hit specific breakpoints. For example, if we create a boilerplate C# httptriggered Azure function and add a startup.cs file those "early" breakpoints in the file are often missed. Example repo - https://github.com/TroyWitthoeft/AzureFunctionsHostStartupBug
Example of missed breakpoint
Above, why didn't we hit the first breakpoint?
Is there anything we can do to correct this? I've had quite a few dev's trying to get started with DI in C# using startup.cs and having this issue.
Note, I am posting here on the suggestion of @WardenGnaw who is assisting me in the csharp extension repo at issue 3644. He mentioned that your team might be able to assist.
Thoughts... Is it possible to change the
launch.json
file or the${command:azureFunctions.pickProcess}
command to correct for this? Is there someway we can signal to the debugger that we are ready for it to attach?Environment
VSCode = 1.43.0
Azure Functions Extension = 0.21.0
csharp extension = 1.21.12
azure functions core tools = 3.0.2245
dotnet --info
The text was updated successfully, but these errors were encountered: