Skip to content

Call with out parameter to field type that is not value type fails #321

@aughey

Description

@aughey

There's an issue calling a method with an out parameter with an argument that is a field value.

Test that shows the problem is here: https://github.com/Thinksplat/FastExpressionCompiler/blob/master/test/FastExpressionCompiler.IssueTests/OutFieldParameterIssue.cs

The debug IL clearly shows that for integers (value types) it emits ldflda while for this string (non value type) it emits ldfld.

I've narrowed down the issue to FastExpressionCompiler.cs between lines 4104 and 4113. There is logic to set isByAddress for value types, but not for any other type. I don't understand the complexities of the parentflags here, so I don't want to give a fix that might be overly simple.

However, it seem that no matter what, if byRefIndex is not -1, then isByAddress MUST be set to true. I'd like to, just outside that if after line 4113, add a line that says
if(byRefIndex != -1) { isByAddress = true; }
but there may be subtilities that I don't understand.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions