praeclarum / Bind

A small but powerful C# library for data binding
Other
204 stars 34 forks source link

crash when execption is raised within expression called via DynamicInvoke #10

Open JosiCoder opened 7 years ago

JosiCoder commented 7 years ago

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?