Skip to content
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

Step Over sometimes executes a lot more than one statement #109885

Closed
TonyValenti opened this issue Nov 16, 2024 · 32 comments · Fixed by #110484
Closed

Step Over sometimes executes a lot more than one statement #109885

TonyValenti opened this issue Nov 16, 2024 · 32 comments · Fixed by #110484
Assignees
Labels
area-Diagnostics-coreclr in-pr There is an active PR which will close this issue when it is merged
Milestone

Comments

@TonyValenti
Copy link

Description

When I'm debugging code, I use F10 (Step Over) to walk through one line of code at a time.
In .NET 8x, this worked fine.
In .NET 9x, sometimes it seems like it runs a TON more code until it hits a breakpoint.

I suspect I might be running into some variant of #109785 and I specifically notice this happening in ForEach code as described in #109812 .

I see this is slated to be fixed in .NET 10.0, however, this is a major annoyance and I am very hopeful this will be approved for servicing.

Reproduction Steps

Not sure.

Expected behavior

"Step Over" works like .NET 8.0

Actual behavior

"Step Over" sometimes works like "Continue"

Regression?

Yes.

Known Workarounds

Use .NET 8.0

Configuration

No response

Other information

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Nov 16, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Nov 16, 2024
@huoyaoyuan huoyaoyuan added area-Diagnostics-coreclr and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Nov 16, 2024
Copy link
Contributor

Tagging subscribers to this area: @tommcdon
See info in area-owners.md if you want to be subscribed.

@tommcdon tommcdon added this to the 10.0.0 milestone Nov 19, 2024
@tommcdon tommcdon removed the untriaged New issue has not been triaged by the area owner label Nov 19, 2024
@rowi123
Copy link

rowi123 commented Nov 29, 2024

I have this bug too.
For me it is not related to for each at all
Also i see this is added to the dotnet 10 milestone, that's crazy: this a bug preventing normal debugging workflow

For me hot reload also doesn't work in dot net 9

More info:
https://stackoverflow.com/questions/79212086/net-9-debugger-step-over-f10-behaving-like-continue-f5

@TonyValenti
Copy link
Author

Ya. Debugging really sucks in .NET 9.0 right now.

If I had to guess, it was added to 10.x as a matter of policy, but I'm about 100% certain that once everybody gets back from holiday (and enough people complain here), this will be approved for servicing pretty quickly.

@akalcik
Copy link

akalcik commented Nov 29, 2024

Same here

@Woudjee
Copy link

Woudjee commented Dec 2, 2024

I have the same issue. It happens all the time and is very tricky. I cannot debug effectively currently.

@Woudjee
Copy link

Woudjee commented Dec 2, 2024

I have this bug too. For me it is not related to for each at all Also i see this is added to the dotnet 10 milestone, that's crazy: this a bug preventing normal debugging workflow

For me hot reload also doesn't work in dot net 9

More info: https://stackoverflow.com/questions/79212086/net-9-debugger-step-over-f10-behaving-like-continue-f5

Wait what. Is this not going to be fixed anytime soon? Do you have a source?

@rowi123
Copy link

rowi123 commented Dec 2, 2024

Image

@Woudjee
Copy link

Woudjee commented Dec 2, 2024

This bug is genuinely unworkable for me. When pressing F10, it keeps going significantly further than what I want. I am trying to debug geometrical algorithms. I can only do this when I know exactly where I am in this process. It is impossible to do when it goes all over the place. I am trying to combat this by putting a breakpoint every other line, but this is simply not working.

When will this be fixed?

@rowi123
Copy link

rowi123 commented Dec 2, 2024

Why are you still on 9?
I moved back to 8 i am staying far far away from this for at least a quarter year.

@Woudjee
Copy link

Woudjee commented Dec 2, 2024

I put a lot of effort into moving all my projects to .NET 9.0 last week. I need it for MAUI Blazor Hybrid. It is not possible for me to go back. Have been looking forward to .NET 9.0 for a long time.

@Woudjee
Copy link

Woudjee commented Dec 2, 2024

I also continue to have try-catches that are not catching errors. Is this also a .NET 9.0 thing?

@tommcdon
Copy link
Member

tommcdon commented Dec 2, 2024

Hello all! Our workflow is to fix issues in main, then backport to servicing as needed. Since this issue applies to both to main (.NET 10) and .NET 9, we put the issue in the .NET 10 milestone. Once we have a fix for the problem, we plan to backport a servicing-friendly version of it to .NET 9.

@tommcdon
Copy link
Member

tommcdon commented Dec 2, 2024

I also continue to have try-catches that are not catching errors. Is this also a .NET 9.0 thing?

Hello @Woudjee! This sounds like a different problem. Please feel free to open a new github issue to track it.

@Woudjee
Copy link

Woudjee commented Dec 3, 2024

Hello all! Our workflow is to fix issues in main, then backport to servicing as needed. Since this issue applies to both to main (.NET 10) and .NET 9, we put the issue in the .NET 10 milestone. Once we have a fix for the problem, we plan to backport a servicing-friendly version of it to .NET 9.

Thank you for your reply. That makes sense! In your experience, how much time does it usually take for these kinds of issues to be resolved? A week? A month? A quarter? Then I can somewhat anticipate on this during my work the upcoming period 👍

@rowi123
Copy link

rowi123 commented Dec 3, 2024

Hello all! Our workflow is to fix issues in main, then backport to servicing as needed. Since this issue applies to both to main (.NET 10) and .NET 9, we put the issue in the .NET 10 milestone. Once we have a fix for the problem, we plan to backport a servicing-friendly version of it to .NET 9.

Thank you for explaining this,

@f2bo
Copy link

f2bo commented Dec 6, 2024

Disabling CET in the project file seems to help in my case.

<CETCompat>false</CETCompat>

@Woudjee
Copy link

Woudjee commented Dec 6, 2024

@f2bo if that solves this, I consider it a solution. But what does it mean? I’ll try it out next week. 👍👍

@f2bo
Copy link

f2bo commented Dec 6, 2024

@Woudjee

if that solves this, I consider it a solution.

I don't know if this is the solution but I noticed that single-stepping appears to behave normally once you apply this setting, at least in my case and after a very quick test. I thought I'd mention it here and see what other people's experience is. I posted simple repro steps here, in case anyone wants to give it a try.

But what does it mean?

https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-9/runtime#control-flow-enforcement-technology

@Woudjee
Copy link

Woudjee commented Dec 6, 2024

@f2bo of course I understand. It’s more a temporary workaround than an actual solution. But if it - for now - allows me to debug, that’s immensely valuable.

I read the section you highlighted. For the software that I am currently developing I believe it’s fine to turn it off. I will let you know my findings later next week.

@dotnet-policy-service dotnet-policy-service bot added the in-pr There is an active PR which will close this issue when it is merged label Dec 9, 2024
@tommcdon tommcdon modified the milestones: 10.0.0, 9.0.x Dec 9, 2024
@tommcdon tommcdon reopened this Dec 9, 2024
@tommcdon
Copy link
Member

tommcdon commented Dec 9, 2024

Reactivated for backport to 9.0

@f2bo
Copy link

f2bo commented Dec 10, 2024

@tommcdon I see that you've identified the cause. Just out of curiosity, did this turn out to be related to CET or does disabling it only mask out the problem? I couldn't tell from the PR. I should mention that after disabling it, I haven't seen a single failure whereas previously I could almost never complete a debugging session without an incident.

@thaystg
Copy link
Member

thaystg commented Dec 10, 2024

As far as we understood during our tests with CET enabled would cause the race condition, between the APC call and the stepping on debugger, happens more frequently, that is why disabling the CET you didn't get the problem anymore.

@Woudjee
Copy link

Woudjee commented Dec 10, 2024

Well done for figuring it out 👍 when do you expect us to be able to update to the version which contains this fix in .NET 9.0?

@f2bo
Copy link

f2bo commented Dec 10, 2024

@thaystg Got it. Thanks!

@TonyValenti
Copy link
Author

I am really hoping a .NET 9.0.1 lands today and includes this fix.

@thaystg
Copy link
Member

thaystg commented Dec 11, 2024

We have addressed the bug in an upcoming patch release. I'll update this issue when the patch has been released. Thanks for reporting it!

@rowi123
Copy link

rowi123 commented Dec 12, 2024

Good work.

I had 2 issues: this one and i also noticed hot reload not working (no errors, just no code updates).
Does this patch release include anything on that issue?

@tommcdon
Copy link
Member

Fixed via #110533

@Woudjee
Copy link

Woudjee commented Dec 19, 2024

Good work.

I had 2 issues: this one and i also noticed hot reload not working (no errors, just no code updates). Does this patch release include anything on that issue?

I have something similar. I have a web api project that sometimes throws a C# compiler error after changing some code and pressing hot reload. This happens sporadically, I don't have any clear order of steps to reproduce this. Happens to me maybe once per workday.

@Woudjee
Copy link

Woudjee commented Dec 19, 2024

Fixed via #110533

Is there a manual download or other action required to retrieve the fix?

@akalcik
Copy link

akalcik commented Dec 19, 2024

@Woudjee It is labeled for milestone 9.0.2 so it should be included in the next upcoming service release of .NET 9

@Woudjee
Copy link

Woudjee commented Dec 19, 2024

@Woudjee It is labeled for milestone 9.0.2 so it should be included in the next upcoming service release of .NET 9

Ah good one. After reading your message, I managed to find that as well. Currently the 9.0.2 milestone is 72% completed so that’s looking promising 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Diagnostics-coreclr in-pr There is an active PR which will close this issue when it is merged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants