private StreamTraceRecord CreateAndAddRecord(string activity, long position, long count, int result, Exception ex) { #if NET40 StackTrace trace = (_captureStack ? new StackTrace(2, _captureStackFileDetails) : null); #else // Note: Not sure about the 'ex' parameter to StackTrace, but the new StackTrace does not accept a frameCount StackTrace trace = (_captureStack ? new StackTrace(ex, _captureStackFileDetails) : null); #endif StreamTraceRecord record = new StreamTraceRecord(_records.Count, activity, position, trace); record.CountArg = count; record.Result = result; record.ExceptionThrown = ex; _records.Add(record); if (_fileOut != null) { _fileOut.WriteLine(record); if (trace != null) { _fileOut.Write(trace.ToString()); } if (ex != null) { _fileOut.WriteLine(ex); } _fileOut.Flush(); } return(record); }
private StreamTraceRecord CreateAndAddRecord(string activity, long position, long count, int result, Exception ex) { StackTrace trace = (_captureStack ? new StackTrace(2, _captureStackFileDetails) : null); StreamTraceRecord record = new StreamTraceRecord(_records.Count, activity, position, trace); record.CountArg = count; record.Result = result; record.ExceptionThrown = ex; _records.Add(record); if (_fileOut != null) { _fileOut.WriteLine(record); if (trace != null) { _fileOut.Write(trace.ToString()); } if (ex != null) { _fileOut.WriteLine(ex); } _fileOut.Flush(); } return(record); }
private StreamTraceRecord CreateAndAddRecord(string activity, long position, long count, int result, Exception ex) { StackTrace trace = (_captureStack ? new StackTrace(2, _captureStackFileDetails) : null); StreamTraceRecord record = new StreamTraceRecord(_records.Count, activity, position, trace); record.CountArg = count; record.Result = result; record.ExceptionThrown = ex; _records.Add(record); if (_fileOut != null) { _fileOut.WriteLine(record); if (trace != null) { _fileOut.Write(trace.ToString()); } if (ex != null) { _fileOut.WriteLine(ex); } _fileOut.Flush(); } return record; }