Repository: dotnet/efcore
File: src/EFCore.Relational/Update/ModificationCommand.cs (C#)

Code before:
                {
                    HandleSharedColumns(
                        complexProperty.ComplexType, entry, complexTableMapping, deleting, sharedTableColumnMap);
                }
            }
        }

        static List<JsonPartialUpdatePathEntry>? FindJsonPartialUpdateInfo(IUpdateEntry entry, List<IUpdateEntry> processedEntries)
        {
            var result = new List<JsonPartialUpdatePathEntry>();
            var currentEntry = entry;
            var currentOwnership = currentEntry.EntityType.FindOwnership()!;

            while (currentEntry.EntityType.IsMappedToJson())
            {
                var jsonPropertyName = currentEntry.EntityType.GetJsonPropertyName()!;
                currentOwnership = currentEntry.EntityType.FindOwnership()!;
                var previousEntry = currentEntry;
#pragma warning disable EF1001 // Internal EF Core API usage.
                currentEntry = ((InternalEntityEntry)currentEntry).StateManager.FindPrincipal(
                    (InternalEntityEntry)currentEntry, currentOwnership)!;
#pragma warning restore EF1001 // Internal EF Core API usage.

                if (currentEntry == null || processedEntries.Contains(currentEntry))
                {
                    return null;
                }

                var ordinal = default(int?);
                if (!currentOwnership.IsUnique
                    && previousEntry.EntityState != EntityState.Added
                    && previousEntry.EntityState != EntityState.Deleted)
                {
                    var ordinalProperty = previousEntry.EntityType.FindPrimaryKey()!.Properties.Last();
                    ordinal = (int)previousEntry.GetCurrentProviderValue(ordinalProperty)! - 1;
                }

                var pathEntry = new JsonPartialUpdatePathEntry(
                    currentOwnership.PrincipalEntityType.IsMappedToJson() ? jsonPropertyName : "$",
                    ordinal,
                    currentEntry,
                    currentOwnership.GetNavigation(pointsToPrincipal: false)!); // TODO: Handle complex properties, Issue #36429

                result.Insert(0, pathEntry);
            }

            var modifiedMembers = entry.EntityType.GetFlattenedProperties().Where(entry.IsModified).ToList();
            if (modifiedMembers.Count == 1)
            {
                result.Add(
                    new JsonPartialUpdatePathEntry(

Review comment (suggestion):
`FindPrincipal(...)` can now legitimately return null (as handled by the new check), but the assignment still uses the null-forgiving operator (`!`). That makes the nullability annotations misleading within this loop. Consider making `currentEntry` nullable inside `FindJsonPartialUpdateInfo` and removing the null-forgiving operator, adjusting the loop condition to explicitly handle null.

Code after:
                {
                    HandleSharedColumns(
                        complexProperty.ComplexType, entry, complexTableMapping, deleting, sharedTableColumnMap);
                }
            }
        }

        static List<JsonPartialUpdatePathEntry>? FindJsonPartialUpdateInfo(IUpdateEntry entry, List<IUpdateEntry> processedEntries)
        {
            var result = new List<JsonPartialUpdatePathEntry>();
            IUpdateEntry? currentEntry = entry;
            var currentOwnership = currentEntry.EntityType.FindOwnership()!;

            while (currentEntry is not null && currentEntry.EntityType.IsMappedToJson())
            {
                var jsonPropertyName = currentEntry.EntityType.GetJsonPropertyName()!;
                currentOwnership = currentEntry.EntityType.FindOwnership()!;
                var previousEntry = currentEntry;
#pragma warning disable EF1001 // Internal EF Core API usage.
                currentEntry = ((InternalEntityEntry)currentEntry).StateManager.FindPrincipal(
                    (InternalEntityEntry)currentEntry, currentOwnership);
#pragma warning restore EF1001 // Internal EF Core API usage.

                if (currentEntry == null || processedEntries.Contains(currentEntry))
                {
                    return null;
                }

                var ordinal = default(int?);
                if (!currentOwnership.IsUnique
                    && previousEntry.EntityState != EntityState.Added
                    && previousEntry.EntityState != EntityState.Deleted)
                {
                    var ordinalProperty = previousEntry.EntityType.FindPrimaryKey()!.Properties.Last();
                    ordinal = (int)previousEntry.GetCurrentProviderValue(ordinalProperty)! - 1;
                }

                var pathEntry = new JsonPartialUpdatePathEntry(
                    currentOwnership.PrincipalEntityType.IsMappedToJson() ? jsonPropertyName : "$",
                    ordinal,
                    currentEntry,
                    currentOwnership.GetNavigation(pointsToPrincipal: false)!); // TODO: Handle complex properties, Issue #36429

                result.Insert(0, pathEntry);
            }

            var modifiedMembers = entry.EntityType.GetFlattenedProperties().Where(entry.IsModified).ToList();
            if (modifiedMembers.Count == 1)
            {
                result.Add(
                    new JsonPartialUpdatePathEntry(