Skip to content

Commit abb8c03

Browse files
committed
Fix MethodFinder.cs
1 parent fca6cb2 commit abb8c03

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/System.Linq.Dynamic.Core/Parser/SupportedMethods/MethodFinder.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,17 @@ public int FindBestMethodBasedOnArguments(IEnumerable<MethodBase> methods, ref E
104104

105105
if (applicable.Length == 1)
106106
{
107-
MethodData md = applicable[0];
108-
method = ((MethodInfo)md.MethodBase).GetBaseDefinition();
109-
args = md.Args;
107+
var methodData = applicable[0];
108+
if (methodData.MethodBase is MethodInfo methodInfo)
109+
{
110+
method = methodInfo.GetBaseDefinition();
111+
}
112+
else
113+
{
114+
method = methodData.MethodBase;
115+
}
116+
117+
args = methodData.Args;
110118
}
111119
else
112120
{

test/System.Linq.Dynamic.Core.Tests/System.Linq.Dynamic.Core.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<AssemblyName>System.Linq.Dynamic.Core.Tests</AssemblyName>
66
<DebugType>full</DebugType>
77
<SignAssembly>True</SignAssembly>
8+
<LangVersion>10</LangVersion>
89
<AssemblyOriginatorKeyFile>../../src/System.Linq.Dynamic.Core/System.Linq.Dynamic.Core.snk</AssemblyOriginatorKeyFile>
910
<ProjectGuid>{912FBF24-3CAE-4A50-B5EA-E525B9FAEC80}</ProjectGuid>
1011
</PropertyGroup>

0 commit comments

Comments
 (0)