The Enrollments field is required
After following this tutorial, I tried to edit a student, but kept being returned to the edit page, no error showing.

After looking around online, i found this forum post that advised checking the ModelState. 🤔💭Weird, there were no model errors presented on my page to begin with.
So I looked for where Model errors were being rendered. After finding the helper tag on the scaffolded Edit.cshtml page:
... <div asp-validation-summary="ModelOnly" class="text-danger"></div> ...
I changed it to this:
... <div asp-validation-summary="All" class="text-danger"></div> ...
Which finally showed me this error:

I checked my project settings and found that I left Nullable to enabled. I changed it to disabled, which allowed the TryUpdateModelAsync to pass true.
From what I understood when reading the document, because the TryUpdateModelAsync didn't specify an update to the Enrollments navigation property, it shouldn't have tried to update it in the first place.
With Nullable enabled, the TryUpdateModelAsync set the properties specified, then iterated through get on each, which threw the ModelError on the get of the Enrollments, which we didn't touch.
Is this an expected behavior and why?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: d420a47c-b0c7-b242-3116-3d6382467ffb
- Version Independent ID: 06d9d8e6-7069-fd79-561c-363cc4487821
- Content: Tutorial: Implement CRUD Functionality - ASP.NET MVC with EF Core
- Content Source: aspnetcore/data/ef-mvc/crud.md
- Product: aspnet-core
- Technology: aspnetcore-data
- GitHub Login: @Rick-Anderson
- Microsoft Alias: riande
This will be addressed in #27124
I checked my project settings and found that I left Nullable to enabled. I changed it to disabled, which allowed the TryUpdateModelAsync to pass true.
Hi as per @savionlee's suggestion I can confirm this works on .NET 6 for me. I am more than happy to do a pull request with this page to include an alert for the user to disable nullable.
I will only do this with your permission first before I try to do a pull request, with credit to the OP of course. Thanks.
@LayersOfAbstraction please do a PR
We should change all asp-validation-summary from:
... <div asp-validation-summary="ModelOnly" class="text-danger"></div> ...
to this:
... <div asp-validation-summary="All" class="text-danger"></div> ...