FormUrlEncodedJson calls wrong overload of Error.Argument
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 45/100
Línea de trabajo
Comienza en src/System.Net.Http.Formatting/Formatting/FormUrlEncodedJson.cs, especialmente en FormUrlEncodedJson.AddToArray, y compara sus llamadas a Error.Argument con las sobrecargas de src/Common/Error.cs. Confirma que las llamadas que usan únicamente una cadena de formato y argumentos de formato resuelven a la sobrecarga prevista; se considera terminado cuando la cadena de formato deja de tratarse como un nombre de parámetro.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C#
- Estrellas
- 897
- Forks
- 358
- Merge medio
- 40 min
- PR fusionados (30 d)
- 1
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de aspnet/AspNetWebStack
-
Needs: Author Feedback
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
aspnet/AspNetWebStack#430 · 2 comentarios ·
-
Needs: Author Feedback
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
aspnet/AspNetWebStack#429 · 1 comentario ·
-
Needs: Author Feedback
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
aspnet/AspNetWebStack#428 · 1 comentario ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
aspnet/AspNetWebStack#407 · 1 comentario ·
-
bug
aspnet/AspNetWebStack#399 · 2 comentarios · 1 asignado ·
Todos los issues de aspnet/AspNetWebStack
Issues similares
-
CS0162 "Unreachable code detected" warning from a MSBuildTemp .tmp file in every game project Abiertobug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
-
Type: enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
apache/arrow-adbc#4809 ·
-
type/automation type/tech-debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
microsoft/vscode-azurefunctions#5197 · 1 comentario ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
microsoft/microsoft-ui-reactor#1274 ·