Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to pass Constant as call parameter by-reference #441

Closed
dadhi opened this issue Dec 13, 2024 · 0 comments
Closed

Fails to pass Constant as call parameter by-reference #441

dadhi opened this issue Dec 13, 2024 · 0 comments
Assignees
Labels
Milestone

Comments

@dadhi
Copy link
Owner

dadhi commented Dec 13, 2024

See #438 for the context.

When attempting to pass results as ref to a lambda, we ran into problems. We've implemented a workaround by assigning the result to a local variable first before passing it to the lambda.

// FEC throws System.InvalidProgramException: Common Language Runtime detected an invalid program.
// WORKAROUND: Assign to local variable and pass variable by ref

var callRefMethod = typeof( TestClass ).GetMethod( nameof( TestClass.MethodThatTakesARef ) );

var block = Block(
    typeof( int ),
    Call( callRefMethod!, Constant( 42 ) )
);

var lambda = Lambda<Func<int>>( block );
var compiledLambda = lambda.CompileFast();
@dadhi dadhi changed the title Problem with passing call parameter by ref in Block Fails to pass Constant as call parameter by-reference Dec 13, 2024
@dadhi dadhi closed this as completed in 6522c84 Dec 13, 2024
@dadhi dadhi self-assigned this Dec 13, 2024
@dadhi dadhi added the bug label Dec 13, 2024
@dadhi dadhi added this to the v5.0.1 milestone Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant