Make base-type collection stack-safe for deep inheritance chains

Abierto
#4,357 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
3-5 días
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
csharp
Área
backend

Línea de trabajo

Start with BaseTypeCollector.CollectBaseTypes() and the GetNonInterfaceBaseTypes() callsites mentioned for deconstruction and BAML. Trace how collection currently detects cycles and orders base types, then find the relevant test project and add coverage for a deep acyclic inheritance chain. Done means traversal completes without stack overflow while preserving cycle detection and base-before-derived ordering.

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

Descripción

Follow-up to PR #4336 and finding ANT-2026-OLTG8WBX.

PR #4336 fixes the reported short cyclic-base walks by using GetNonInterfaceBaseTypes(). That helper delegates to recursive BaseTypeCollector.CollectBaseTypes(), so sufficiently deep inheritance chains can still exhaust the process stack before traversal completes (or before a long cycle is detected). The PR's deconstruction and BAML callsites now use this recursive path.

Reproduced against PR head 94b35ee08da199645594783cd3ec93c3e6afbcd5 on .NET 11: a metadata assembly with 150,000 classes in one inheritance chain (T0 : System.Object, each subsequent Tn : Tn-1) causes T149999.GetNonInterfaceBaseTypes().Count() to terminate with Stack overflow, after about 47,575 repeated BaseTypeCollector.CollectBaseTypes() frames. The previous iterative DirectBaseTypes walk completed and counted 150,001 types.

Consider making base-type collection iterative while preserving its cycle detection and base-before-derived ordering, and add coverage for a deep acyclic chain (and, if useful, a long cycle).

Assisted-by: OpenCode:gpt-6-luna:OpenCode

Lenguaje dominante
C#
Estrellas
27.1k
Forks
3.8k
Merge medio
1 d 23 h
PR fusionados (30 d)
44

Preparar el entorno

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 icsharpcode/ILSpy

Todos los issues de icsharpcode/ILSpy

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.