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

Add [DebuggerGuidedStepThrough] to new invoker methods #89596

Merged
merged 3 commits into from
Aug 1, 2023

Conversation

steveharter
Copy link
Member

@steveharter steveharter commented Jul 27, 2023

Add these missing attributes to make the newly added invoker APIs consistent with the standard invoke APIs in NativeAOT.

CoreClr info: using "Just My Code" does work with the newly added invoker APIs for CoreClr; that is, you can step into the invoked method. With "Just My Code" off, however, the stepped-into method is hit-or-miss for both the new invoker APIs as well as the existing ones (one of the internal framework methods will be stepped into). We could add [DebuggerHidden] and [DebuggerStepThrough] to more methods to make step-in work when "Just My Code" is off, like we already have in the standard invoke code, although in general that doesn't work either and\or is fragile due to reflection calling non-reflection code such as in Span, Signature, etc. which would also need these attributes.

@ghost
Copy link

ghost commented Jul 27, 2023

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

Add these missing attributes to make the newly added invoker APIs consistent with the standard invoke APIs in NativeAOT.

CoreClr info: using "Just My Code" does work with the newly added invoker APIs for CoreClr; that is, you can step into the invoked method. With "Just My Code" off, however, the stepped-into method is hit-or-miss for both the new invoker APIs as well as the existing ones (one of the internal framework methods will be stepped into). We could add [DebuggerHidden] and [DebuggerStepThrough] to make step-in work when "Just My Code" is off, although in general that is fragile due to calling many non-reflection scenarios.

Author: steveharter
Assignees: steveharter
Labels:

area-System.Reflection, area-NativeAOT-coreclr

Milestone: -

@jkotas
Copy link
Member

jkotas commented Jul 27, 2023

Does this change cause any observable behavior under unmanaged debugger that's the only debugging story for native AOT at the moment?

@MichalStrehovsky
Copy link
Member

Does this change cause any observable behavior under unmanaged debugger that's the only debugging story for native AOT at the moment?

Native AOT currently doesn't respect this (the attribute is a leftover from .NET Native). It should be possible to make this work on Windows with 0xF00F00/0xFEEFEE magic line numbers, but I'm not aware of a way to make this work outside Windows so the priority of implementing this is lower right now since we can't make it work crossplat.

@steveharter
Copy link
Member Author

@MichalStrehovsky feel free to close this PR if it doesn't matter - I just created this PR for consistency.

@MichalStrehovsky
Copy link
Member

@MichalStrehovsky feel free to close this PR if it doesn't matter - I just created this PR for consistency.

I don't mind either way - it's possible we'll want to fix this at some point. But to merge this, uses in ConstructorInvoker.cs will need to be updated to call PreviousCallContainsDebuggerStepInCode, similar to how it's called in MethodInvoker.cs.

Copy link
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@steveharter steveharter merged commit 13d0a0a into dotnet:main Aug 1, 2023
103 of 106 checks passed
@steveharter steveharter deleted the AddDebugAttr branch August 1, 2023 14:06
@ghost ghost locked as resolved and limited conversation to collaborators Aug 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants