Closed peterhuene closed 1 year ago
@kpreisser Thanks for the feedback! You're right, the change to guide users towards an untyped callback in cases where there were too many results inadvertently let the invalid types slip through to type conversion causing the more confusing error message.
Your suggestion makes the most sense and provides a really great error message. I'll push a fix.
@kpreisser I've pushed up the suggested change. Would you mind reviewing if you have the time?
This PR removes the slow reflection-based fallback that is performed when a callback delegate is provided that does not conform to the (up to) 12 parameter and (up to) 4 results overloads of
Function.FromCallback
andLinker.DefineFunction
.As a result, functions that take more than 12 parameters or return more than 4 results must use an untyped callback where the parameters and results are passed as spans of
ValueBox
.The callbacks will no longer be invoked via reflection under any circumstances.