Skip to content

Undocumented breaking change in ASP.NET Core 7 model binding when using Nullability and model contains generic field #47744

Open
@johnkors

Description

@johnkors

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I guess this is more due to the docs not covering it, but there is a breaking change for how ASP.NET Core 7 handles nullability and Required fields for model binding. It's lacking from this list: https://learn.microsoft.com/en-us/dotnet/core/compatibility/7.0

Expected Behavior

Either the same behaviour re model binding between 6 and 7, or the docs listing this specific detail as a breaking change.

Steps To Reproduce

https://github.com/johnkors/aspnetcore7-compat-repro

GitHub actions running the tests in both 6 and 7 is provided, which shows one test running OK in ASP.NET Core 6 but failing in 7.

image

There is a small difference in how nullability and required is handled if the model contains 1 vs more than 1 fields, and the model contains a generic field.

Exceptions (if any)

No response

.NET Version

7

Anything else?

ASP.NET Core 7

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesinvestigate

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions