Alex Rivera | Logout

Debug.WriteLine in release build

Asked 2011-03-24T12:58:44.237
72

Is there a way to use Debug.WriteLine in a release build without defining DEBUG?

Edit
Report

1 Answer

51

No. If you don't define the DEBUG preprocessor symbol, any calls to Debug.* will be removed by the compiler due to the [Conditional("DEBUG")] attribute being applied.

You might want to consider Trace.WriteLine or other logging techniques though.

answered 2011-03-24T13:01:07.740

Your Answer