Captain Comic
Captain Comic

Reputation: 16216

TraceInformation method call is disabled by compiler

I put a breakpoint to the last line of code. Breakpoint is disabled. Why? It looks like the code is excluded by some condition. The constructor of TraceSource works, and I can verify the object is OK and all listeners are OK. It really looks bizarre. I stop on int a=1; and then debugger skips TraceInformation by ignoring it. The configuration is DEBUG x86.

public TraceSource _fixTraceSource;

_fixTraceSource = new TraceSource(_configSection.TraceSourceName);

int a = 1; // dummy line to set breakpoint
_fixTraceSource.TraceInformation("FIX -> toAdmin Message: {0}", message.ToString());

Upvotes: 1

Views: 575

Answers (1)

Marc Gravell
Marc Gravell

Reputation: 1064204

TraceInformation is marked:

[Conditional("TRACE")]

So you need the TRACE symbol defined at compile time for it to be included. This is usually by checking the "Define TRACE constant" box in the project properties page (it is enabled by default for both Debug and Release profiles, so somebody has unchecked it at some point).

Upvotes: 3

Related Questions