/// <summary> /// Print data. Note that this method is called FROM DIFFERNET THREADS which means you need to properly /// lock any read-write data you access. It turns out Out.Writeline is already thread safe so /// there is nothing I have to do in this case. /// </summary> static void Print(TraceEvent data, SymbolReader symbolReader) { // There are a lot of data collection start on entry that I don't want to see (but often they are quite handy if (data.Opcode == TraceEventOpcode.DataCollectionStart) { return; } // V3.5 runtimes don't log the stack and in fact don't event log the exception name (it shows up as an empty string) // Just ignore these as they are not that interesting. if (data is ExceptionTraceData && ((ExceptionTraceData)data).ExceptionType.Length == 0) { return; } Out.WriteLine("EVENT: {0}", data.ToString()); var callStack = data.CallStack(); if (callStack != null) { // Because symbol lookup is complex, error prone, and expensive TraceLog requires you to be explicit. // Here we look up names in this call stack using the symbol reader. ResolveNativeCode(callStack, symbolReader); Out.WriteLine("CALLSTACK: {0}", callStack.ToString()); } }