Test-Connection -BufferSize 0 reports buffer size of 32
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 84/100
Hướng nghiên cứu
Bắt đầu trong TestConnectionCommand.cs và kiểm tra logic báo cáo kích thước bộ đệm được mô tả trong issue. Tái hiện bằng Test-Connection -TargetName localhost -Count 1 -BufferSize 0, sau đó xác minh rằng đầu ra và PingStatus.BufferSize báo cáo 0 trong khi bộ đệm phản hồi vẫn trống. Hoàn tất khi các yêu cầu có kích thước 0 byte không còn báo cáo kích thước mặc định.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Steps to reproduce
Run the Test-Connection cmdlet specifying a buffer size of 0, then inspect the BufferSize property of the output PingStatus object, or check the returned table:
$result = Test-Connection -TargetName localhost -Count 1 -BufferSize 0
Write-Host "Result BufferSize property: $($result.BufferSize)"
Write-Host "Actual Reply.Buffer.Length: $($result.Reply.Buffer.Length)"
Expected behavior
The cmdlet output and the BufferSize property should correctly reflect the requested buffer size of 0:
Result BufferSize property: 0
Actual Reply.Buffer.Length: 0
Actual behavior
The cmdlet output and the BufferSize property incorrectly report 32:
Result BufferSize property: 32
Actual Reply.Buffer.Length: 0
The console output table also reports the BufferSize (B) as 32:
Ping Source Address Latency BufferSize Status
(ms) (B)
---- ------ ------- ------- ---------- ------
1 localhost ::1 0 32 Success
Error details
No exception is thrown. The ping completes successfully but outputs incorrect metadata.
Environment data
Name Value
---- -----
PSVersion 7.6.3
PSEdition Core
GitCommitId 7.6.3
OS Microsoft Windows 10.0.26200
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.4
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Additional Context
This is caused by the following logic in TestConnectionCommand.cs:
buffer.Length == 0 ? DefaultSendBufferSize : buffer.Length
When -BufferSize 0 is passed, GetSendBuffer(0) allocates a 0-length array (new byte[0]). Since buffer.Length is 0, the expression evaluates to DefaultSendBufferSize (32), misreporting the buffer size as 32 bytes even though a 0-byte payload was actually sent.
- Ngôn ngữ chính
- C#
- Star
- 55.5k
- Fork
- 8.5k
- Merge trung bình
- 1 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 97
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PowerShell/PowerShell
-
Issue-Enhancement Needs-Triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
PowerShell/PowerShell#28061 · 2 reaction ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
PowerShell/PowerShell#28037 ·
-
Needs-Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
PowerShell/PowerShell#27973 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
PowerShell/PowerShell#27720 ·
-
Issue-Bug Up-for-Grabs WG-Cmdlets WG-Reviewed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
PowerShell/PowerShell#27670 · 3 bình luận ·
Tất cả issue của PowerShell/PowerShell
Issue tương tự
-
Documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
cake-build/cake#5024 ·
-
Gå gjennom ESLint-suppressions Đang mởFrontend status/draft TechnicalDebt
Độ khó 2/5 1-2 ngày Mức phù hợp với người mới 75/100
Altinn/altinn-auth#4143 ·
-
.NET Flaky Test Testing Tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
getsentry/sentry-dotnet#5617 · 1 bình luận ·
-
Add more to the documentation Đang mở:watch: Not Triaged dotnet-fsharp/svc
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Client customer-reported needs-team-attention question Service Attention WebPubSub
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Azure/azure-sdk-for-net#63292 · 3 bình luận · 1 reaction ·