Skip to content

Hide Environment.CallEntryPoint in unhandled exception message#127677

Open
jkotas wants to merge 1 commit intodotnet:mainfrom
jkotas:hide-callentrypoint
Open

Hide Environment.CallEntryPoint in unhandled exception message#127677
jkotas wants to merge 1 commit intodotnet:mainfrom
jkotas:hide-callentrypoint

Conversation

@jkotas
Copy link
Copy Markdown
Member

@jkotas jkotas commented May 2, 2026

The idea in #126222 was to hide CallEntryPoint helper in the unhandled exception stacktraces, but it did not actually happen.

@jkotas
Copy link
Copy Markdown
Member Author

jkotas commented May 2, 2026

throw new Exception() before this fix prints

Unhandled exception. System.Exception: Exception of type 'System.Exception' was thrown.
   at Program.<Main>$(String[] args)
   at System.Environment.CallEntryPoint(IntPtr entryPoint, String[]* pArgument, Int32* pReturnValue, Boolean captureException, Exception* pException)

with this fix:

Unhandled exception. System.Exception: Exception of type 'System.Exception' was thrown.
   at Program.<Main>$(String[] args)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates CoreCLR’s exception stack trace capture logic to suppress the System.Environment.CallEntryPoint helper frame so it no longer appears in stack traces (notably for top-level/unhandled exception reporting).

Changes:

  • Skip adding stack frames when the current MethodDesc is g_pEnvironmentCallEntryPointMethodDesc during StackTraceInfo::AppendElement.
  • Preserve the existing filtering behavior for diagnostics-hidden frames.

Comment thread src/coreclr/vm/excep.cpp
Comment thread src/coreclr/vm/excep.cpp
@jkotas jkotas requested a review from janvorli May 2, 2026 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants