Skip to content

Commit 17687f5

Browse files
authored
Improve detection of Record types (#24409)
1 parent fd9f17d commit 17687f5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Mvc/Mvc.Core/src/ModelBinding/Metadata/DefaultBindingMetadataProvider.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ private static ConstructorInfo GetRecordTypeConstructor(Type type, ConstructorIn
143143
static bool IsRecordType(Type type)
144144
{
145145
// Based on the state of the art as described in https://github.com/dotnet/roslyn/issues/45777
146-
var cloneMethod = type.GetMethod("<>Clone", BindingFlags.Public | BindingFlags.Instance);
146+
var cloneMethod = type.GetMethod("<Clone>$", BindingFlags.Public | BindingFlags.Instance) ??
147+
type.GetMethod("<>Clone", BindingFlags.Public | BindingFlags.Instance);
147148
return cloneMethod != null && cloneMethod.ReturnType == type;
148149
}
149150
}

0 commit comments

Comments
 (0)