Skip to content

[release/10.0] Fix native EH in external shared libs on macOS - #131434

Merged
agocke merged 2 commits into
release/10.0from
backport/pr-130693-to-release/10.0
Aug 11, 2026
Merged

agocke merged 2 commits into
release/10.0from
backport/pr-130693-to-release/10.0

Conversation

@github-actions

@github-actions github-actions Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #130693 to release/10.0

/cc @janvorli

Customer Impact

  • Customer reported
  • Found internally

There is an exception-handling issue on macOS when throwing and catching some standard C++ exceptions in a native C++ lib. When customer pinvokes into a shared library that uses C++ exception handling internally and throws / catches standard c++ exceptions like std::out_of_range and others, it can fail to catch those. Even though the exception stays within the confines of the native code of the shared library.

The hosts (dotnet, apphost, corerun, nethost) get local copies of typeinfo for several of these exceptions and these copies are not hidden. When an external shared library is loaded, the linker resolves references to those typeinfo instances to the local copies in the host instead of the ones in the libc++. That results in failures matching these exception types in c++ catch.

Regression

  • Yes
  • No

Testing

Directed test shared by the customer, CI testing, local coreclr and libraries tests.

Risk

Low, it just prevents exporting symbols from hosts (except of _GetCurrentClrDetails from corerun). Those symbols are not needed for anything.

janvorli added 2 commits July 27, 2026 19:07
There is an exception-handling issue on macOS when throwing and catching
some standard C++ exceptions in a native C++ lib. The hosts (dotnet,
apphost, corerun, nethost) get local copies of typeinfo for several
of these exceptions and these copies are not hidden. When an external
shared library is loaded, the linker resolves references to those typeinfo
instances to the local copies in the host instead of the ones in
the libc++. That results in failures matching these exception types
in c++ catch.

The fix is to disable exporting symbols from these hosts (except for the
_get_hostfxr_path from the nethost, which is needed)
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@svick

svick commented Aug 6, 2026

Copy link
Copy Markdown
Member

Hi,

the code complete date for 10.0.12 (the September 2026 release) is Monday 10 August. Make sure to merge this PR on that date at the latest, or it won't make it into that release.

As a reminder, if this is a product change, you also need Tactics approval before merging this PR (test-only or infra-only changes don't require Tactics approval).

@janvorli janvorli self-assigned this Aug 7, 2026
@janvorli janvorli added this to the 10.0.x milestone Aug 7, 2026
@janvorli janvorli added the Servicing-consider Issue for next servicing release review label Aug 7, 2026
@janvorli
janvorli requested a review from jkotas August 7, 2026 15:06
@rbhanda rbhanda added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Aug 7, 2026
@rbhanda rbhanda modified the milestones: 10.0.x, 10.0.12 Aug 7, 2026
@agocke

agocke commented Aug 11, 2026

Copy link
Copy Markdown
Member

/ba-g all failures are known

@agocke
agocke merged commit 41747d9 into release/10.0 Aug 11, 2026
168 of 172 checks passed
@agocke
agocke deleted the backport/pr-130693-to-release/10.0 branch August 11, 2026 21:31
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Host Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants