The byref-typed variable '{0}' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. ...