Skip to content

Conversation

@davidwrighton
Copy link
Member

@davidwrighton davidwrighton commented Dec 11, 2025

This is supposed to throw NullReferenceException. Make it so.

Fixes the GitHub_35000 test.

This is supposed to throw NullReferenceException. Make it so.
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @BrzVlad, @janvorli, @kg
See info in area-owners.md if you want to be subscribed.

Copy link
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 fixes a bug in the CoreCLR interpreter where dispatching an open virtual delegate with a null this pointer would cause undefined behavior instead of throwing the expected NullReferenceException. The fix adds an explicit null check before the virtual method dispatch.

Key Changes

  • Added NULL_CHECK for the this argument before calling GetMethodDescOfVirtualizedCode in the open virtual delegate dispatch path
  • Refactored to extract pThisArg as a local variable, improving code clarity and efficiency
  • Removed unused lambda captures (stack and callArgsOffset)

@davidwrighton davidwrighton enabled auto-merge (squash) December 11, 2025 02:30
@davidwrighton davidwrighton merged commit 14df2b3 into dotnet:main Dec 11, 2025
109 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 11, 2026
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.

2 participants