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

Đang mở
#4,357 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp
Lĩnh vực
backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
C#
Star
27.1k
Fork
3.8k
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
44

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của icsharpcode/ILSpy

Tất cả issue của icsharpcode/ILSpy

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.