Skip to content

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

Merged
wadepickett merged 9 commits into
mainfrom
copilot/document-iformfilecollection-vs-ireadonlylist
May 23, 2026
Merged

Document IFormFileCollection vs IReadOnlyList<IFormFile> binding behavior in Minimal APIs#37180
wadepickett merged 9 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.

Copy link
Copy Markdown
Contributor

@tdykstra tdykstra left a comment

Choose a reason for hiding this comment

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

Looks good; I left a couple take it or leave it suggestions.

Comment thread aspnetcore/fundamentals/minimal-apis/includes/parameter-binding8-10.md Outdated
Comment thread aspnetcore/fundamentals/minimal-apis/includes/parameter-binding8-10.md Outdated
name to id link fix per feedback from tdykstra
@wadepickett
Copy link
Copy Markdown
Contributor

wadepickett commented May 22, 2026

@copilot.
In the new "IFormFile collection binding behavior" section in aspnetcore/fundamentals/minimal-apis/includes/parameter-binding8-10.md::
Replace all backtick-only API type references with xref: links.

For example, IFormFileCollection should become xref:Microsoft.AspNetCore.Http.IFormFileCollection, IFormFile should become xref:Microsoft.AspNetCore.Http.IFormFile, and IReadOnlyList<IFormFile> should link at least IFormFile. Follow the same xref conventions already used elsewhere in this file. Verify al xref links, if you can't, indicate so.

…on binding section

Agent-Logs-Url: https://github.com/dotnet/AspNetCore.Docs/sessions/560fca58-5c8b-4fe3-8d5b-eaec8740cd24

Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 22, 2026

@copilot.
In the new "IFormFile collection binding behavior" section in aspnetcore/fundamentals/minimal-apis/includes/parameter-binding8-10.md::
Replace all backtick-only API type references with ...

Replaced all backtick-only API type references with xref links in commit 867e9c6. Used <xref:Microsoft.AspNetCore.Http.IFormFile>, <xref:Microsoft.AspNetCore.Http.IFormFileCollection>, <xref:System.Collections.Generic.IReadOnlyList%601>, <xref:Microsoft.AspNetCore.Http.IFormCollection.Files>, and <xref:Microsoft.AspNetCore.Http.AsParametersAttribute>. Table cells use the [DisplayName](xref:Full.Name) pattern for readability.

Copilot AI requested a review from wadepickett May 22, 2026 22:16
@wadepickett wadepickett merged commit 95f70ce into main May 23, 2026
4 checks passed
@wadepickett wadepickett deleted the copilot/document-iformfilecollection-vs-ireadonlylist branch May 23, 2026 00:01
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

4 participants