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

AsyncCollectionRequestMessage<T> creates a CancellationTokenSource that never gets disposed

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

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
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
csharp
Lĩnh vực
tooling

Hướng nghiên cứu

Bắt đầu với src/CommunityToolkit.Mvvm/Messaging/Messages/AsyncCollectionRequestMessage{T}.cs và kiểm tra cách CancellationTokenSource riêng tư của nó được tạo và sử dụng. Xác định vòng đời giải phóng an toàn cho message, sau đó xác minh rằng API được đề xuất giải phóng source mà không làm hỏng hành vi hủy.

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

Mô tả

bug :bug:
Describe the bug

I was examining the code for the the AsyncCollectionRequestMessage class and I noticed it creates a private CancellationTokenSource that never gets Dispose() called on it.

I looked at CancellationTokenSource's dispose methods and it's non-trivial, potentially disposing of a System.ITimer and a ManualResetEvent - both things that are potentially finite resources, so better to release ASAP.

Regression

No response

Steps to reproduce

No reproduction, just observation of the code.

Expected behavior

There should be an opportunity to dispose the CancellationTokenSource. Most obvious possible way would be to make thing that comes to mind would be make AsyncCollectionRequestMessage<T> implement IDispose so that users could call it.

Screenshots

No response

IDE and version

VS 2022

IDE version

17.14.11

Nuget packages
  • CommunityToolkit.Common
  • CommunityToolkit.Diagnostics
  • CommunityToolkit.HighPerformance
  • CommunityToolkit.Mvvm (aka MVVM Toolkit)
Nuget package version(s)

8.4.0

Additional context

No response

Help us help you

Yes, I'd like to be assigned to work on this item

Ngôn ngữ chính
C#
Star
3.8k
Fork
401
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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 CommunityToolkit/dotnet

Tất cả issue của CommunityToolkit/dotnet

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.