From 2022.2 this issue is fixed, but its impossible to backport as it was a fundamental change. In 2022.2 we use Roslyn to extract the information we need.
The Parser used before 2022.2 also evaluates all #if as true, so in this case it breaks as it does not compile.