Skip to content

Fix: Handle null propagation for nullable navigation properties when expanding and ordering#1565

Open
MartinTopfstedtSinc wants to merge 1 commit into
OData:mainfrom
SINC-GmbH:bug/expand_and_orderBy_nullable_navigation_properties
Open

Fix: Handle null propagation for nullable navigation properties when expanding and ordering#1565
MartinTopfstedtSinc wants to merge 1 commit into
OData:mainfrom
SINC-GmbH:bug/expand_and_orderBy_nullable_navigation_properties

Conversation

@MartinTopfstedtSinc
Copy link
Copy Markdown

Summary

Fixes null propagation handling when expanding nullable navigation properties and ordering by their nullable properties.

Changes

  • Added IsNullableNavigationProperty() extension method to IEdmProperty to properly identify nullable navigation properties
  • Updated QueryBinder.CreatePropertyAccessExpression() to include nullable navigation properties in null propagation checks
  • The fix ensures that when HandleNullPropagation is enabled, both nullable value types AND nullable navigation properties are properly handled during query binding

Why this matters

Previously, when expanding a nullable navigation property and then ordering by an integer property of that same nullable navigation property, the null propagation logic would not correctly handle the nullable navigation property case, potentially causing runtime errors or incorrect query results.

The updated logic now checks for either:

  1. Nullable value types (ExpressionBinderHelper.IsNullable(source.Type))
  2. Nullable navigation properties (property.IsNullableNavigationProperty())

This ensures consistent null handling across both scenarios.

@MartinTopfstedtSinc
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="SINC"

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.

1 participant