Reputation: 1804
Using
this.Database.Log = s => System.Diagnostics.Debug.WriteLine(s);
in the ctor of my data context class only works (prints queries to the output window) in Debug build configuration.
What do I need to do to get it to print to the output window in Visual Studio for a custom build configuration (not Debug)?
Upvotes: 3
Views: 532
Reputation: 127563
All methods in the System.Diagnostics.Debug
class have [Conditional("DEBUG")]
on them, that means if the DEBUG
compiler symbol is not set from the calling code then the code does not run.
If you want your custom build configuration to run those methods you need to turn on the DEBUG
compile symbol. Before you try that you may want to switch to the System.Diagnostics.Trace
class, that is enabled by default in both debug and release and relies on a [Conditional("TRACE")]
on each method.
Upvotes: 4