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