Skip to content

Commit

Permalink
Exclude throwing subexpr's from partial evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
stakx committed Jun 24, 2020
1 parent a05c885 commit 6812e06
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Moq/Evaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,17 @@ public override Expression Visit(Expression expression)
base.Visit(expression);
if (!this.cannotBeEvaluated)
{
if (this.fnCanBeEvaluated(expression))
bool canBeEvaluated;
try
{
canBeEvaluated = this.fnCanBeEvaluated(expression);
}
catch
{
canBeEvaluated = false;
}

if (canBeEvaluated)
{
this.candidates.Add(expression);
}
Expand Down

0 comments on commit 6812e06

Please sign in to comment.