Skip to content

Document IFormFileCollection vs IReadOnlyList<IFormFile> binding behavior in Minimal APIs#37180

Open
Copilot wants to merge 7 commits into
mainfrom
copilot/document-iformfilecollection-vs-ireadonlylist
Open

Document IFormFileCollection vs IReadOnlyList<IFormFile> binding behavior in Minimal APIs#37180
Copilot wants to merge 7 commits into
mainfrom
copilot/document-iformfilecollection-vs-ireadonlylist

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

Internal review link directly to new section

Fixes #37173

Minimal API form-file binding has undocumented behavioral differences depending on parameter type — IFormFileCollection ignores the parameter name and binds all files, IReadOnlyList<IFormFile> binds only name-matched files, and other collection types silently don't bind at all. Requested by framework team in dotnet/aspnetcore#66757.

Changes:

  • Added #### IFormFile collection binding behavior subsection to parameter-binding8-10.md after the existing form-file binding content
  • Added comparison table covering IFormFileCollection, IFormFile, IReadOnlyList<IFormFile>, and unsupported collection types
  • Added note that the same behavior applies to [AsParameters] and form-mapped complex types (shared form-mapping layer with Blazor)
Parameter type Bound value Honors parameter name?
IFormFileCollection All files in HttpContext.Request.Form.Files No
IFormFile Single file matching parameter name Yes
IReadOnlyList<IFormFile> All files matching parameter name Yes
Other collection types Not supported n/a

Internal previews

📄 File 🔗 Preview link
aspnetcore/fundamentals/minimal-apis/parameter-binding.md aspnetcore/fundamentals/minimal-apis/parameter-binding

Copilot AI changed the title [WIP] Document IFormFileCollection vs IReadOnlyList<IFormFile> binding behavior Document IFormFileCollection vs IReadOnlyList<IFormFile> binding behavior in Minimal APIs May 21, 2026
Copilot AI requested a review from wadepickett May 21, 2026 20:45
@wadepickett wadepickett requested a review from Copilot May 21, 2026 20:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Documents the (previously undocumented) differences in Minimal API form-file binding behavior across IFormFile-related parameter types, helping readers choose the correct type for “all files” vs “name-matched files” scenarios.

Changes:

  • Added an “IFormFile collection binding behavior” subsection under the existing form binding section.
  • Added a comparison table describing binding results for IFormFileCollection, IFormFile, IReadOnlyList<IFormFile>, and unsupported collection shapes.
  • Added a note that the same behavior applies for [AsParameters] and form-mapped complex types.

Comment thread aspnetcore/fundamentals/minimal-apis/includes/parameter-binding8-10.md Outdated
Comment thread aspnetcore/fundamentals/minimal-apis/includes/parameter-binding8-10.md Outdated
wadepickett and others added 2 commits May 21, 2026 13:57
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@wadepickett wadepickett marked this pull request as ready for review May 21, 2026 20:58
Comment thread aspnetcore/fundamentals/minimal-apis/includes/parameter-binding8-10.md Outdated
Copy link
Copy Markdown
Contributor

@wadepickett wadepickett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after a few fixes have now been addressed.

@wadepickett wadepickett requested a review from tdykstra May 22, 2026 19:54
@wadepickett
Copy link
Copy Markdown
Contributor

wadepickett commented May 22, 2026

@danroth27, Internal review link directly to the new section for your review on this binding behaviour update.

@wadepickett wadepickett requested a review from danroth27 May 22, 2026 20:04
@wadepickett
Copy link
Copy Markdown
Contributor

@copilot, also update the file that uses this include to have the latest ms.date value in the metadata:
dotnet/AspNetCore.Docs/refs/heads/main/aspnetcore/fundamentals/minimal-apis/parameter-binding.md

update this:
ms.date: 10/22/2025

to this:
ms.date: 05/22/2026

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 22, 2026

@copilot, also update the file that uses this include to have the latest ms.date value in the metadata:
dotnet/AspNetCore.Docs/refs/heads/main/aspnetcore/fundamentals/minimal-apis/parameter-binding.m...

Updated ms.date to 05/22/2026 in aspnetcore/fundamentals/minimal-apis/parameter-binding.md.

Copilot AI requested a review from wadepickett May 22, 2026 20:16
Copy link
Copy Markdown
Contributor

@wadepickett wadepickett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, after a few updates were applied.

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.

Document IFormFileCollection vs IReadOnlyList<IFormFile> binding behavior in Minimal APIs

3 participants