Open
Conversation
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue: #507
Root cause:
IQueryProvider.CreateQuery(Expression)was using the fullIQueryable<T>type as the collection generic argument and then invoking the internalRedisCollection<T>constructor with public-only reflection, so projected queries failed before enumeration.Fix: derive the sequence element type from the query expression, invoke the internal constructor with non-public binding flags, and preserve the original document root type on projected collections.
Tests run:
dotnet test test/Redis.OM.Unit.Tests/Redis.OM.Unit.Tests.csproj --filter FullyQualifiedName~Redis.OM.Unit.Tests.RediSearchTests.SearchTests.TestSelectViaNonGenericQueryProvider --no-restoredotnet test test/Redis.OM.Unit.Tests/Redis.OM.Unit.Tests.csproj -f net7.0 --filter FullyQualifiedName~Redis.OM.Unit.Tests.RediSearchTests.SearchFunctionalTests.SelectNameViaNonGenericQueryProvider --no-restoredotnet test test/Redis.OM.Unit.Tests/Redis.OM.Unit.Tests.csproj -f net6.0 --filter FullyQualifiedName~Redis.OM.Unit.Tests.RediSearchTests.SearchFunctionalTests.SelectNameViaNonGenericQueryProvider --no-restoreRisk: low. The change is scoped to query-provider instantiation for projected queryables; the main remaining risk is compatibility with other expression shapes that also flow through non-generic
CreateQuery.Note
Low Risk
Low risk, scoped to
RedisQueryProvider.CreateQuery(Expression)instantiation logic for projected queryables; primary risk is unexpected element/root type inference for uncommon expression shapes.Overview
Fixes projection queries created via the non-generic
IQueryProvider.CreateQuery(Expression)path soSelect/chained projections no longer fail before enumeration.The provider now derives the sequence element type from the expression type, uses reflection that can invoke non-public
RedisCollection<T>constructors, and preserves the original documentRootTypeon projected collections. Adds unit + functional coverage for selectingNamevia manually-builtQueryable.Selectexpressions using the non-generic provider.Written by Cursor Bugbot for commit 5237572. This will update automatically on new commits. Configure here.