FormUrlEncodedJson calls wrong overload of Error.Argument
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
- 45/100
Hướng nghiên cứu
Bắt đầu trong src/System.Net.Http.Formatting/Formatting/FormUrlEncodedJson.cs, đặc biệt là FormUrlEncodedJson.AddToArray, và so sánh các lệnh gọi Error.Argument của nó với các overload trong src/Common/Error.cs. Xác nhận rằng các lệnh gọi chỉ sử dụng một chuỗi định dạng và các đối số định dạng sẽ phân giải đến overload mong muốn; hoàn tất khi chuỗi định dạng không còn bị coi là tên tham số.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
src/System.Net.Http.Formatting/Formatting/FormUrlEncodedJson.cs contains several Error.Argument calls that do not specify the parameter name. For example, in the FormUrlEncodedJson.AddToArray method:
The arguments in this call are a format string from resources, and a string to use as a format argument. The call is intended to go to the internal static ArgumentException Argument(string messageFormat, params object[] messageArgs) method that is defined here:
Instead, it goes to the internal static ArgumentException Argument(string parameterName, string messageFormat, params object[] messageArgs) method that is defined here:
The format string that was read from Properties.Resources.FormUrlEncodedMismatchingTypes thus becomes misused as the parameter name.
I have not tried to reproduce this bug in practice, but the incorrect call is evident from the IL disassembly of lib/netstandard2.0/System.Net.Http.Formatting.dll in the Microsoft.AspNet.WebApi.Client 6.0.0 package:
IL_001b: call string System.Net.Http.Properties.Resources::get_FormUrlEncodedMismatchingTypes()
IL_0020: ldarg.1
IL_0021: ldarg.1
IL_0022: ldlen
IL_0023: conv.i4
IL_0024: ldc.i4.1
IL_0025: sub
IL_0026: call string System.Net.Http.Formatting.FormUrlEncodedJson::BuildPathString(string[],
int32)
IL_002b: call !!0[] [netstandard]System.Array::Empty<object>()
IL_0030: call class [netstandard]System.ArgumentException System.Web.Http.Error::Argument(string,
string,
object[])
IL_0035: throw
In the Microsoft.AspNet.WebApi.Client 4.0.20505 package (released on 31 May 2012), the FormUrlEncodedJson.AddToArray method did not have this bug yet. In the Microsoft.AspNet.WebApi.Client 4.0.20710 package (released on 11 August 2012), the method had the bug. I think the bug was introduced by commit f19f4683cc36ebb2666fa36f6dcd1825f4b214aa in May 2012.
Because the bug is so old and is not known to cause any problems in practice, I suspect you might decide not to fix it.
- Ngôn ngữ chính
- C#
- Star
- 897
- Fork
- 358
- Merge trung bình
- 40 phút
- Pull request đã merge (30 ngày)
- 1
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 aspnet/AspNetWebStack
-
Needs: Author Feedback
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
aspnet/AspNetWebStack#430 · 2 bình luận ·
-
Needs: Author Feedback
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
aspnet/AspNetWebStack#429 · 1 bình luận ·
-
Needs: Author Feedback
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
aspnet/AspNetWebStack#428 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
aspnet/AspNetWebStack#407 · 1 bình luận ·
-
bug
aspnet/AspNetWebStack#399 · 2 bình luận · 1 người được giao ·
Tất cả issue của aspnet/AspNetWebStack
Issue tương tự
-
bug frontend good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
NavigationViewItemAutomationPeer implements IInvokeProvider but never advertises the Invoke pattern Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
unoplatform/uno#24629 ·
-
agentic-workflows Needs: Triage :mag: State: In-PR
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
CS0162 "Unreachable code detected" warning from a MSBuildTemp .tmp file in every game project Đang mởbug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Type: enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
apache/arrow-adbc#4809 ·