The following expression lambda is fine (compiles and runs):
Func<string, int> test = s => s?.Length ?? 0;
Console.WriteLine(test("t")); //1
Converting it to expression tree:
System.Linq.Expressions.Expression<Func<string, int>> e = s => s?.Length ?? 0;
Console.WriteLine(e);
Generates a compile-time error:
error CS8072: An expression tree lambda may not contain a null propagating operator.
Question:
Why it is not allowed to convert the code from lambda to an expression tree?