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

StackTraceHiddenAttribute not respected #91309

Closed
MichalStrehovsky opened this issue Mar 25, 2021 · 0 comments · Fixed by #91572
Closed

StackTraceHiddenAttribute not respected #91309

MichalStrehovsky opened this issue Mar 25, 2021 · 0 comments · Fixed by #91572

Comments

@MichalStrehovsky
Copy link
Member

No description provided.

@MichalStrehovsky MichalStrehovsky transferred this issue from dotnet/runtimelab Aug 30, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Aug 30, 2023
@MichalStrehovsky MichalStrehovsky added this to the 9.0.0 milestone Aug 30, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Aug 30, 2023
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Sep 5, 2023
MichalStrehovsky added a commit to MichalStrehovsky/runtime that referenced this issue Sep 5, 2023
Fixes dotnet#91309.

NativeAOT sources stack trace data from two places: reflection metadata (if the method was reflection-visible), or specialized stack trace metadata. Finding out if a method should be hidden from stack traces in the former case is easy: just look for the attribute. The latter case requires compiler work.

In this PR, I'm extending the specialized stack trace metadata format to contain a bit that says if the frame should be hidden or not. I'm doing it in a way that we can also do this for compiler-generated methods (that otherwise don't show up in stack trace metadata).

The runtime behavior is similar to CoreCLR - the methods show up in individual stack frames, but if we stringify the stack trace, they'll be skipped. I'm adding a specialized test that tests the two sources of metadata.

I'm also marking the methods involved in the startup path as stack trace hidden.

There is one thing I skipped - CoreCLR has logic to force generate the stack trace metadata for the first frame. If we do that, the compiler-generated startup code starts showing up in stack traces again. Marking `Main` as stack trace hidden might lead to an empty stack trace.
jkotas pushed a commit that referenced this issue Sep 6, 2023
Fixes #91309.

NativeAOT sources stack trace data from two places: reflection metadata (if the method was reflection-visible), or specialized stack trace metadata. Finding out if a method should be hidden from stack traces in the former case is easy: just look for the attribute. The latter case requires compiler work.

In this PR, I'm extending the specialized stack trace metadata format to contain a bit that says if the frame should be hidden or not. I'm doing it in a way that we can also do this for compiler-generated methods (that otherwise don't show up in stack trace metadata).

The runtime behavior is similar to CoreCLR - the methods show up in individual stack frames, but if we stringify the stack trace, they'll be skipped. I'm adding a specialized test that tests the two sources of metadata.

I'm also marking the methods involved in the startup path as stack trace hidden.

There is one thing I skipped - CoreCLR has logic to force generate the stack trace metadata for the first frame. If we do that, the compiler-generated startup code starts showing up in stack traces again. Marking `Main` as stack trace hidden might lead to an empty stack trace.
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Sep 6, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Oct 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant