I tried the following code:
class Magic {
[Conditional("DEBUG")]
public static void DoMagic( int stuff )
{
}
public static int ComputeMagic()
{
throw new InvalidOperationException();
}
}
class Program
{
static void Main(string[] args)
{
Magic.DoMagic(Magic.ComputeMagic());
}
}
and it looks like in Release build the exception is not thrown so not only the call to a method marked with ConditionalAttribute
is removed, but also the parameters computation is eliminated.
Is such behavior guaranteed?