Conditional not valid on 'function' because its return type is not void
ConditionalAttribute cannot be applied to a method that has a return type other than void. The reason for this is that any other return type for a method may be needed by another part of your program.
The following sample generates CS0578:
public class MyClass { [System.Diagnostics.ConditionalAttribute("a")] public int TestMethod() { // CS0578 return 0; } public static void Main() { } }
To resolve this error, you must either delete ConditionalAttribute, or you must change the return value of the method to void.