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

Abierto
#137,225 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
18/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
csharp, wasm
Área
compilers

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
C#
Estrellas
18.4k
Forks
5.8k
Merge medio
2 d 19 h
PR fusionados (30 d)
590

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de dotnet/runtime

Todos los issues de dotnet/runtime

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.