Complete `FirstWithoutOrderByAndFilterWarning` coverage for subqueries
Maintainer thường phản hồi trong vòng 2 ngày
@z0rimo đang làm issue này rồi.
Từ ngày 16/11/2026.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start by reviewing PR #39218 and issue #39129 to understand the existing relational warning check; then inspect the separate Cosmos check and query translation paths for TPC, views, and FromSql. The issue lists the remaining cases and required safeguards, but leaves several behavior decisions open. Done means resolving those decisions and covering the supported cases while preserving suppression for explicit ordering, intentional filters, and correlations proven to match at most one row.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
PR #39218 fixed #39129 for unordered First/FirstOrDefault over collection-navigation subqueries whose correlation can be identified from relational foreign-key metadata. Several cases were deliberately left out of scope.
This issue tracks the remaining diagnostic gaps and decisions about extending the warning. Some changes would introduce warnings for queries that previously ran without them; applications configuring the warning to throw would be affected.
Remaining warning coverage
-
TPC collection navigations. Detect unordered
First/FirstOrDefaultwhen the dependent source is a TPC hierarchy. Columns projected through the generatedUNIONmay lack the metadata needed by the current FK-correlation check. Account for the concrete tables without assuming that a projected column with missing metadata is a principal-key column. -
Other sources without usable table-column metadata. Investigate equivalent cases involving views and
FromSql. Warn where navigation correlation can be established reliably, without treating arbitrary user filters as relationship correlation. -
Grouping elements. Decide whether to warn for unordered selections such as
GroupBy(...).Select(g => g.First()). These can choose an arbitrary element within each group, but extending the warning affects existing queries and samples. -
Non-FK correlations. Decide whether and when to warn for queries such as
context.Others.Where(o => o.X == b.Y).FirstOrDefault(). A correlation can leave multiple candidate rows even when it does not follow a modeled relationship. Define how to distinguish this from an intentional user filter. -
Filtered unique indexes. Do not assume every filtered unique index guarantees at most one matching row. For example, a unique index on
CustomerIdfiltered to active rows still permits multiple inactive rows. Preserve suppression for SQL Server's conventional nullable unique indexes: theirIS NOT NULLfilter excludes rows that an ordinary equality correlation cannot match. The index filter is provider-specific SQL, so this needs a reliable way to establish whether uniqueness applies to the candidate rows. -
Cosmos parity. Assess the equivalent behavior for supported Cosmos query shapes. Its separate
First/FirstOrDefaultwarning check was unchanged by #39218.
Preserve intentional filters and deterministic selections
- Do not treat null checks on unrelated outer columns as navigation-generated principal-key guards. For example,
c.Orders.FirstOrDefault(o => c.City != null)contains an explicit user filter. - Account for user filters stored in
SelectExpression.Having, not onlyPredicate. For example,c.Orders.GroupBy(o => o.CustomerID).Where(g => g.Count() > 1).Select(g => g.Count()).FirstOrDefault()has an explicit filter and at most one matching group. - Continue suppressing the warning for explicit ordering and correlations proven to match at most one row. Do not infer relationship-key provenance merely from missing column metadata.
- Ngôn ngữ chính
- C#
- Star
- 14.8k
- Fork
- 3.5k
- Merge trung bình
- 3 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 182
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của dotnet/efcore
-
customer-reported
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
GroupBy element `OrderBy(...).First()`/`MaxBy` over an owned type mapped to its own table fails to translateCó thể đã có người làm @cincuranet đã nhận hôm nay. Đang mởarea-groupby area-query
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
dotnet/efcore#39833 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
SQLite: Polygon.Length translates to GLength, which returns 0Có thể đã có người làm @cincuranet đã nhận hôm nay. Đang mởarea-query area-sqlite
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
dotnet/efcore#39826 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Migration lock with LockReleaseBehavior.Transaction doesn't prevent concurrent migrations since per-migration transactionsCó thể đã có người làm @AndriySvyryd đã nhận 1 ngày trước. Đang mởarea-migrations
dotnet/efcore#39824 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Querying a TPC base type with a JSON complex property throwsCó thể đã có người làm @cincuranet đã nhận 1 ngày trước. Đang mởarea-query
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
dotnet/efcore#39814 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của dotnet/efcore
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
SubtitleEdit/subtitleedit#17247 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Restore test cleanup fails on Windows when restored files are read-onlyCó thể đã có người làm @JamBalaya56562 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
duplicati/duplicati#8046 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Bundles Documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
pyrevitlabs/pyRevit#4285 ·
Maintainer thường phản hồi trong vòng 1 ngày