changeset 4:f757da6161a1

!bug 100 + 2h fixed gregression
author cin
date Sun, 24 Aug 2014 17:57:42 +0400
parents 1ef98bd70424
children f7d63a092920
files Source/Data/Linq/Query.cs Source/Data/Linq/ReflectionHelper.cs
diffstat 2 files changed, 3 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Source/Data/Linq/Query.cs	Fri Aug 22 17:34:46 2014 +0400
+++ b/Source/Data/Linq/Query.cs	Sun Aug 24 17:57:42 2014 +0400
@@ -148,7 +148,7 @@
 						{
 							query = new ExpressionBuilder(new Query<T>(), dataContextInfo, expr, null).Build<T>();
 						}
-						catch (Exception)
+						catch (Exception err)
 						{
 							if (!Configuration.Linq.GenerateExpressionTest)
 							{
--- a/Source/Data/Linq/ReflectionHelper.cs	Fri Aug 22 17:34:46 2014 +0400
+++ b/Source/Data/Linq/ReflectionHelper.cs	Sun Aug 24 17:57:42 2014 +0400
@@ -42,12 +42,7 @@
 				//	return ((PropertyInfo)((MemberExpression)ex).Member).GetGetMethod();
 
 				/// HACK
-				var mce = (MethodCallExpression)ex;
-				var mi = mce.Method;
-				if (mi.IsVirtual && mi.DeclaringType != mce.Object.Type)
-					mi = mce.Object.Type.GetMethod(mi.Name, mi.GetParameters().Select(p => p.ParameterType).ToArray());
-
-				return mi;
+				return ExtractMethodInfo ((MethodCallExpression)ex);
 			}
 		}
 
@@ -66,7 +61,7 @@
 
 		public static MethodInfo ExtractMethodInfo(MethodCallExpression mce) {
 			var mi = mce.Method;
-			if (mi.IsVirtual && mi.DeclaringType != mce.Object.Type)
+			if (mi.IsVirtual && mi.DeclaringType != mce.Object.Type && !mce.Object.Type.IsInterface)
 				mi = mce.Object.Type.GetMethod(mi.Name, mi.GetParameters().Select(p => p.ParameterType).ToArray());
 
 			return mi;