Repro steps and actual behavior
FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.EvaluateQuotation raises a NotSupportedException when the quotation contains sequencing or variable/property/field mutation:
let eval = LeafExpressionConverter.EvaluateQuotation
eval <@ a; b @>
eval <@ a <- b @>
eval <@ a.b <- c @>
// System.NotSupportedException: Could not convert the following F# Quotation to a LINQ Expression Tree
Also, when the quotation is of type unit and the compiled expression tree is of type System.Void (such as a void method call) or something else (a mutation), Linq raises an ArgumentException:
eval <@ System.Console.WriteLine("Hello, World") @>
// System.ArgumentException: Expression of type 'System.Void' cannot be used for return type 'Microsoft.FSharp.Core.Unit'
Expected behavior
The function should correctly compile the expression to Linq tree and execute in these cases.
Known workarounds
Avoid these problematic constructs in the quotation. For example, write a.set_b(c) instead of a.b <- c.
Repro steps and actual behavior
FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.EvaluateQuotationraises aNotSupportedExceptionwhen the quotation contains sequencing or variable/property/field mutation:Also, when the quotation is of type
unitand the compiled expression tree is of typeSystem.Void(such as a void method call) or something else (a mutation), Linq raises anArgumentException:Expected behavior
The function should correctly compile the expression to Linq tree and execute in these cases.
Known workarounds
Avoid these problematic constructs in the quotation. For example, write
a.set_b(c)instead ofa.b <- c.