Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/coreclr/vm/finalizerthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ extern "C" void SystemJS_ExecuteFinalizationCallback()
{
CONTRACTL
{
#ifdef TARGET_UNIX // because UNINSTALL_UNHANDLED_MANAGED_EXCEPTION_TRAP is catching exceptions only on Unix. On Windows OS is handling that.
NOTHROW;
#else // TARGET_UNIX
THROWS;
#endif // TARGET_UNIX
Comment on lines +52 to +56
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

In TARGET_BROWSER builds, TARGET_UNIX is always defined by the build (see clrdefinitions.cmake), so this #ifdef TARGET_UNIX/#else in the contract is effectively dead code and the inline comment about Windows is misleading in this context. Consider simplifying the contract to a single NOTHROW; (or otherwise keying off whether UNINSTALL_UNHANDLED_MANAGED_EXCEPTION_TRAP is active) to avoid an unreachable branch and reduce confusion.

Suggested change
#ifdef TARGET_UNIX // because UNINSTALL_UNHANDLED_MANAGED_EXCEPTION_TRAP is catching exceptions only on Unix. On Windows OS is handling that.
NOTHROW;
#else // TARGET_UNIX
THROWS;
#endif // TARGET_UNIX
NOTHROW;

Copilot uses AI. Check for mistakes.
GC_TRIGGERS;
MODE_PREEMPTIVE;
}
Expand Down
Loading