FormUrlEncodedJson calls wrong overload of Error.Argument
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 45/100
調査の方向性
src/System.Net.Http.Formatting/Formatting/FormUrlEncodedJson.cs から始め、特に FormUrlEncodedJson.AddToArray を確認し、その Error.Argument 呼び出しを src/Common/Error.cs のオーバーロードと比較します。フォーマット文字列とフォーマット引数だけを使用する呼び出しが意図したオーバーロードに解決されることを確認してください。フォーマット文字列がパラメーター名として扱われなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- C#
- スター
- 897
- フォーク
- 358
- 平均マージ
- 40分
- マージ済み PR(30日)
- 1
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
aspnet/AspNetWebStack のほかの issue
-
Needs: Author Feedback
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
aspnet/AspNetWebStack#430 · コメント 2 件 ·
-
Needs: Author Feedback
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
aspnet/AspNetWebStack#429 · コメント 1 件 ·
-
Needs: Author Feedback
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
aspnet/AspNetWebStack#428 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
aspnet/AspNetWebStack#407 · コメント 1 件 ·
-
bug
aspnet/AspNetWebStack#399 · コメント 2 件 · 担当者 1 名 ·
aspnet/AspNetWebStack の issue をすべて見る
似ている issue
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
Type: enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
apache/arrow-adbc#4809 ·
-
type/automation type/tech-debt
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
microsoft/vscode-azurefunctions#5197 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
microsoft/microsoft-ui-reactor#1274 ·