[Mono] Null receiver in open virtual delegate invocation crashes the runtime

未关闭
#137,225 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
一周以上
新手友好度
18/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
csharp, wasm
领域
compilers

调研方向

The failure is a native SIGSEGV in mono_get_addr_compiled_method on Linux ARM64 and a klass assertion in class-accessors.c:73 under the WebAssembly interpreter, both during open virtual delegate invocation with a null receiver. Start from the test OpenDelegate.NullReceiverAfterWarmingUnrelatedVirtualDelegates in src/tests/CoreMangLib/system/delegate/VSD/OpenDelegate.cs and the Mono runtime's delegate invoke path. Done means the null-receiver call throws NullReferenceException on Mono and the SkipOnMono attribute can be removed.

由索引模型根据 Issue 内容生成。

描述

area-VM-meta-mono runtime-mono untriaged
Description

Invoking an open-instance delegate to a virtual method with a null receiver crashes Mono instead of throwing NullReferenceException.

This was exposed by OpenDelegate.NullReceiverAfterWarmingUnrelatedVirtualDelegates, added in dotnet/runtime#136949. The test creates delegates to virtual methods on two unrelated classes, warms both delegates with valid receivers, then invokes them with null receivers.

Reproduction

Use the test source before its Mono exclusion.

Run OpenDelegate.NullReceiverAfterWarmingUnrelatedVirtualDelegates on Mono. The first null-receiver invocation is:

Assert.Throws<NullReferenceException>(() => second(null, 1, 2, 3, 4));
Expected behavior

The invocation throws NullReferenceException, which the assertion catches. The test passes on CoreCLR.

Actual behavior

Reported CI failures in build 1667003:

  • Mono Linux ARM64: native SIGSEGV in mono_get_addr_compiled_method during the assertion’s lambda; process exits with code 134.
  • Mono WebAssembly interpreter: process aborts on the klass assertion in class-accessors.c:73.

These failures terminate the process rather than raising a catchable managed exception. Other Mono configurations have not been established.

Current mitigation

The test is excluded on Mono using method-level SkipOnMono; CoreCLR and sibling-test coverage remain enabled. Re-enable the test on Mono once null-receiver invocation throws the expected managed exception.

[!NOTE]
This issue description was drafted with GitHub Copilot.

主要语言
C#
星标
18.4k
派生
5.8k
平均合并
2 天 19 小时
30 天内合并 PR
590

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

dotnet/runtime 的其他 Issue

查看 dotnet/runtime 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。