Skip to content

Commit 00e9e20

Browse files
committed
Unwrap TargetInvocationException
1 parent 275c9ff commit 00e9e20

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/NHibernate/Linq/Visitors/NhPartialEvaluatingExpressionVisitor.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using System;
1919
using System.Linq;
2020
using System.Linq.Expressions;
21+
using System.Reflection;
2122
using NHibernate.Collection;
2223
using NHibernate.Engine;
2324
using NHibernate.Impl;
@@ -145,7 +146,14 @@ private Expression EvaluateSubtree(Expression subtree)
145146
return constantExpression;
146147
}
147148

148-
return Expression.Constant(ExpressionProcessor.FindValue(subtree), subtree.Type);
149+
try
150+
{
151+
return Expression.Constant(ExpressionProcessor.FindValue(subtree), subtree.Type);
152+
}
153+
catch (TargetInvocationException ex)
154+
{
155+
throw ReflectHelper.UnwrapTargetInvocationException(ex);
156+
}
149157
}
150158

151159
#region NH additions

0 commit comments

Comments
 (0)