Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[Foundation] Make BuildContext's cancellation handlers testable

Đang mở
#545 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 2 ngày

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

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
csharp
Lĩnh vực
build-system, testing

Hướng nghiên cứu

Bắt đầu với BuildContext.RegisterCancellationHandler và UnregisterCancellationHandler, sau đó lần theo subscription của Console.CancelKeyPress và facade BuildManager.CancellationHandler. Thêm hoặc cập nhật các specs để kiểm thử việc đăng ký, hủy đăng ký và cô lập context mà không cần Ctrl+C thực; hoàn tất khi seam vẫn là nội bộ và cả bốn tiêu chí nghiệm thu đều đạt.

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

Mô tả

enhancement target/vCurrent

Follow-up from #451 (FT-2, #307).

Problem

BuildContext.RegisterCancellationHandler / UnregisterCancellationHandler — the two methods BuildManager.CancellationHandler exists to delegate to — have no positive coverage. The only spec on the facade (Cancellation_handler_facade_is_a_no_op_without_an_active_context) exercises the null-context path.

They can't be tested as written: registered handlers only run from the Console.CancelKeyPress subscription, and ConsoleCancelEventArgs has no public constructor, so the event can't be raised from a spec.

Outcome

A registered handler can be shown to run, and an unregistered one shown not to, without depending on a real Ctrl+C.

Needs a seam — e.g. an internal void InvokeCancellationHandlers() on BuildContext that the CancelKeyPress subscription calls, so specs can drive the same path. Worth settling before FT-4/5/6 move more per-run services onto the context.

Acceptance criteria

  • Registering through BuildManager.CancellationHandler with an active context runs the handler when cancellation is signalled.
  • Unregistering stops it running.
  • Handlers registered against one context don't run for another.
  • The seam stays internal — no InternalsVisibleTo to non-test assemblies.
Ngôn ngữ chính
C#
Star
172
Fork
21
Merge trung bình
4 ngày 38 phút
Pull request đã merge (30 ngày)
14

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 Fallout-build/Fallout

Tất cả issue của Fallout-build/Fallout

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.