Skip to content

Breaking change note: proxies throw for members whose accessors cannot be overridden - #5515

Draft
ajcvickers wants to merge 2 commits into
dotnet:mainfrom
ajcvickers:breaking-change-proxy-inaccessible-members
Draft

ajcvickers wants to merge 2 commits into
dotnet:mainfrom
ajcvickers:breaking-change-proxy-inaccessible-members

Conversation

@ajcvickers

@ajcvickers ajcvickers commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Breaking change note for dotnet/efcore#39591 (fixes dotnet/efcore#32352) and dotnet/efcore#39592 (fixes dotnet/efcore#39589): lazy-loading and change-tracking proxies now throw during model validation when they cannot override an accessor they need, for example an internal virtual navigation, or a mapped property with { get; internal set; } under change-tracking proxies, without InternalsVisibleTo("DynamicProxyGenAssembly2"). Before, such members were silently never loaded or never change-tracked.

There are no EF Core 12 docs yet (main of dotnet/efcore is 12.0), so this adds ef-core-12.0/breaking-changes.md with just this entry. I haven't touched toc.yml or the 12.0 what's-new page.

Overlap with #5511: that draft also creates ef-core-12.0/breaking-changes.md (for the migrations --output-dir change). The two PRs will conflict on the file header and the summary table; whichever merges second needs a trivial merge that keeps both rows.

This should be merged together with dotnet/efcore#39591 and dotnet/efcore#39592, and stays a draft until those are merged. Note that #39592 is itself a draft stacked on #39591.

🤖 Generated with Claude Code

…e navigations

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ajcvickers ajcvickers changed the title Breaking change note: proxies throw for navigations whose accessors cannot be overridden Breaking change note: proxies throw for members whose accessors cannot be overridden Nov 10, 2026
@AndriySvyryd
AndriySvyryd requested a lite review from Copilot November 13, 2026 15:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new EF Core 12.0 page is not discoverable because it is missing from the documentation TOC, and several statements overstate or ambiguously describe proxy behavior.

4 open issues
What changed in this PR

Adds the initial EF Core 12 breaking-changes page documenting validation errors when lazy-loading or change-tracking proxies cannot override required accessors.

Changes:

  • Documents proxy accessor visibility requirements, previous silent failures, and new model-validation exceptions.
  • Covers InternalsVisibleTo, opt-outs, mitigations, and representative navigation and property examples.
File Description
entity-framework/​core/​what-is-new/​ef-core-12.0/​breaking-changes.md Adds EF Core 12 breaking-change documentation for proxy accessor accessibility and validation behavior.

Review effort: Lite

@@ -0,0 +1,97 @@
---

#### New behavior

Starting with EF Core 12, model validation throws an <xref:System.InvalidOperationException> when a proxy cannot override the accessor it needs:
Comment on lines +71 to +75
The exception is not thrown:

- For a navigation on which lazy-loading is disabled with `EnableLazyLoading(false)`.
- For lazy-loading proxies when `IgnoreNonVirtualNavigations` is specified. The navigation is then not proxied and is not lazy-loaded, as before.
- For lazy-loading proxies when only the setter is not visible. Only the getter needs to be overridden, and lazy-loading proxies do not intercept properties.

- For a navigation on which lazy-loading is disabled with `EnableLazyLoading(false)`.
- For lazy-loading proxies when `IgnoreNonVirtualNavigations` is specified. The navigation is then not proxied and is not lazy-loaded, as before.
- For lazy-loading proxies when only the setter is not visible. Only the getter needs to be overridden, and lazy-loading proxies do not intercept properties.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants