Skip to content

Fail form binding for types with multiple public constructors - #69352

Draft
mariam-abdulla wants to merge 2 commits into
dotnet:mainfrom
mariam-abdulla:mariam-abdulla-fail-invalid-form-converters
Draft

mariam-abdulla wants to merge 2 commits into
dotnet:mainfrom
mariam-abdulla:mariam-abdulla-fail-invalid-form-converters

Conversation

@mariam-abdulla

Copy link
Copy Markdown
Member

Fixes #69322

Summary

  • validate complex form converters during endpoint creation when the parameter type has multiple public constructors
  • throw a descriptive exception instead of silently passing default(T) or null to the handler
  • use the application's ILoggerFactory for form-mapping diagnostics
  • preserve existing behavior for supported types, malformed form values, and other unsupported model shapes

Tests

  • RequestDelegateFactoryFormMappingTests (5 passed)
  • Microsoft.AspNetCore.Http.Extensions.Tests managed project build (0 warnings, 0 errors)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Sep 16, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Sep 16, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Thanks for your PR, @mariam-abdulla. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Minimal API [FromForm] silently binds default(T) / null when the parameter type has more than one public constructor

1 participant