Skip to content

Conversation

@jamescrosswell
Copy link
Collaborator

Resolves #3701

Analysis

This is handled differently in ASP.NET vs ASP.NET Core.

In ASP.NET Core, the implementation for IHttpRequest is:

public IEnumerable<KeyValuePair<string, IEnumerable<string>>> Form =>
_request?.Form.Select(k => new KeyValuePair<string, IEnumerable<string>>(k.Key, k.Value))
?? Enumerable.Empty<KeyValuePair<string, IEnumerable<string>>>();

In ASP.NET the implementation is:

public IEnumerable<KeyValuePair<string, IEnumerable<string>>>? Form
=> _request.Form.AllKeys.Select(kv => new KeyValuePair<string, IEnumerable<string>>(kv, _request.Form.GetValues(kv)));

Seemingly it's only a problem in ASP.NET... pushing an initial PR so I can switch to my windows box for development.

@jamescrosswell jamescrosswell changed the title WIP - Fix: Invalid form content on ASP.NET causes ArgumentNullException in FormRequestPayloadExtractor Fix: Invalid form content on ASP.NET causes ArgumentNullException in FormRequestPayloadExtractor Nov 11, 2024
@jamescrosswell jamescrosswell changed the title Fix: Invalid form content on ASP.NET causes ArgumentNullException in FormRequestPayloadExtractor Fix: ArgumentNullException in FormRequestPayloadExtractor when handling invalid form data on ASP.NET Nov 11, 2024
@jamescrosswell jamescrosswell marked this pull request as ready for review November 11, 2024 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ArgumentNullException at FormRequestPayloadExtractor

3 participants