From 84e355105be93bd8bbbefbcb0e3aa9d74553702f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 25 Aug 2025 22:56:52 +0000 Subject: [PATCH 1/2] Initial plan From 0e7528f0841aefe6346bb2475ebb41a8be237bfc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 25 Aug 2025 23:07:29 +0000 Subject: [PATCH 2/2] Fix inefficiency in FindIndexerPropertyInfo methods Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com> --- src/EFCore/Metadata/Internal/Model.cs | 2 +- src/EFCore/Metadata/RuntimeModel.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EFCore/Metadata/Internal/Model.cs b/src/EFCore/Metadata/Internal/Model.cs index 392e06ee20f..2f34fcae790 100644 --- a/src/EFCore/Metadata/Internal/Model.cs +++ b/src/EFCore/Metadata/Internal/Model.cs @@ -1173,7 +1173,7 @@ private Model MakeReadonly() /// doing so can result in application failures when updating to a new Entity Framework Core release. /// public virtual PropertyInfo? FindIndexerPropertyInfo(Type type) - => _indexerPropertyInfoMap.GetOrAdd(type, type.FindIndexerProperty()); + => _indexerPropertyInfoMap.GetOrAdd(type, static t => t.FindIndexerProperty()); /// /// Gets a value indicating whether the given MethodInfo represents an indexer access. diff --git a/src/EFCore/Metadata/RuntimeModel.cs b/src/EFCore/Metadata/RuntimeModel.cs index 9ef24ca8640..0ebc492ea0d 100644 --- a/src/EFCore/Metadata/RuntimeModel.cs +++ b/src/EFCore/Metadata/RuntimeModel.cs @@ -290,7 +290,7 @@ private string GetDisplayName(Type type) => _clrTypeNameMap.GetOrAdd(type, t => t.DisplayName()); private PropertyInfo? FindIndexerPropertyInfo([DynamicallyAccessedMembers(IEntityType.DynamicallyAccessedMemberTypes)] Type type) - => _indexerPropertyInfoMap.GetOrAdd(type, type.FindIndexerProperty()); + => _indexerPropertyInfoMap.GetOrAdd(type, static t => t.FindIndexerProperty()); /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to