value is null
uses the constant pattern. Pattern matching was introduced in C# 7, long after expression trees, and cannot (currently) be used in expression trees. It's possible that that will be implemented at some point, but at the moment it's invalid. Note that this is only for expression trees - not lambda expressions that are converted to delegates. For example:
using System;
using System.Linq.Expressions;
class Program
{
static void Main()
{
object x = null;
Func<bool> func = () => x is null; // Fine
Expression<Func<bool>> expression = () => x is null; // CS8122
}
}
There are various restrictions on code within expression trees. You can't use dynamic operations or tuple literals, for example. The restriction on pattern matching is just another example of this.
ReferenceEquals(value, null);
instead, which internally is the same. – Sheathing