You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public static class Numbers
{
public static int GetInt() => 40;
public static int AddTwo(ref int value) => value + 2;
}
public class Program
{
public static void Main()
{
var getIntMethod = typeof(Numbers).GetMethod(nameof(Numbers.GetInt));
var addTwoMethod = typeof(Numbers).GetMethod(nameof(Numbers.AddTwo));
var getIntCall = Expression.Call(getIntMethod);
var expr = Expression.Call(addTwoMethod, getIntCall);
var lambda = Expression.Lambda<Func<int>>(expr).CompileFast();
var result = lambda();
}
}
Expression.Compile is fine with it, but FEC doesn't like it.
The issue is easy to work around by storing the result of the first method in a
variable and passing the variable to the second method, but I wanted to pass the
error along.
The following throws an
InvalidProgramException
Expression.Compile
is fine with it, but FEC doesn't like it.The issue is easy to work around by storing the result of the first method in a
variable and passing the variable to the second method, but I wanted to pass the
error along.
Here is a small dotnetfiddle https://dotnetfiddle.net/PWeV9P that demonstrates the issue.
Thank you for a really nice library.
The text was updated successfully, but these errors were encountered: