dynamicexpresso / DynamicExpresso

C# expressions interpreter
http://dynamic-expresso.azurewebsites.net/
MIT License
1.99k stars 374 forks source link

No longer crash when trying to match a generic method that'll violate the generic constraints #274

Closed metoule closed 1 year ago

metoule commented 1 year ago

Let's say you have a generic method with a generic constraint:

public T GenericMethodWithConstraint<T>(T input) where T : class
{
  return input;
}

It's invalid to call this method with an int, because it violates the generic constraints. This PR catches any generic constraint violation, to avoid crashing.

Fixes #270