FormUrlEncodedJson calls wrong overload of Error.Argument
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 45/100
Direzione di ricerca
Inizia in src/System.Net.Http.Formatting/Formatting/FormUrlEncodedJson.cs, in particolare in FormUrlEncodedJson.AddToArray, e confronta le relative chiamate a Error.Argument con gli overload in src/Common/Error.cs. Verifica che le chiamate che usano solo una stringa di formato e argomenti di formato risolvano nell’overload previsto; l’attività è completata quando la stringa di formato non viene più trattata come nome di parametro.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- C#
- Stelle
- 897
- Fork
- 358
- Merge medio
- 40m
- PR unite (30g)
- 1
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di aspnet/AspNetWebStack
-
Needs: Author Feedback
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
aspnet/AspNetWebStack#430 · 2 commenti ·
-
Needs: Author Feedback
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
aspnet/AspNetWebStack#429 · 1 commento ·
-
Needs: Author Feedback
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
aspnet/AspNetWebStack#428 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
aspnet/AspNetWebStack#407 · 1 commento ·
-
bug
aspnet/AspNetWebStack#399 · 2 commenti · 1 assegnatario ·
Tutte le issue di aspnet/AspNetWebStack
Issue simili
-
bug frontend good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
NavigationViewItemAutomationPeer implements IInvokeProvider but never advertises the Invoke pattern Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
unoplatform/uno#24629 ·
-
agentic-workflows Needs: Triage :mag: State: In-PR
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
CS0162 "Unreachable code detected" warning from a MSBuildTemp .tmp file in every game project Apertabug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
Type: enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
apache/arrow-adbc#4809 ·