dotnet/aspnetcore

Stop using InvalidOperationExceptions to signal invalid ASCII during parsing

Offen

#4.736 geöffnet am 19.07.2018

 (4 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C# (10.653 Forks)batch import
affected-very-fewarea-networkingenhancementfeature-kestrelhelp wantedseverity-nice-to-have

Repository-Metriken

Stars
 (37.933 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

GetAsciiStringNonNullCharacters() currently throws an InvalidOperationException fo invalid or chacters, and the parsing logic catches these InvalidOperationExceptions at various layers to handle the bad request appropriately.

Ideally we could switch to calling a TryGetAsciiStringNonNullCharacters method, but if propagating failure down the stack proves too difficult, we should at least move to a custom exception type so we don't end up obscuring real product bugs by inadvertently swallowing InvalidOperationExceptions thrown by other methods.

Contributor Guide