Bind icon indicating copy to clipboard operation
Bind copied to clipboard

crash when execption is raised within expression called via DynamicInvoke

Open JosiCoder opened this issue 8 years ago • 0 comments

I have a change proposal for public static object EvalExpression (Expression expr)

Instead of:

return lambda.Compile ().DynamicInvoke ();

you could do this:

var deleg = lambda.Compile ();
try {
    return deleg.DynamicInvoke ();
}
catch (Exception ex) {
    return null;
}

This prevents the application from crashing whenever the expressen called via DynamicInvoke throws an exception. Any contraindication?

JosiCoder avatar Nov 25 '16 18:11 JosiCoder