public void TrackArguments(Exception ex, int frameCount, MethodCallInfo call) { try { if (ex == null || call == null || call.Arguments == null || call.Arguments.Count <= 0) { return; } if (call.Method == null) { return; } TryCreate(); MethodCallStackArgumentMap map; if (!MethodArgumentsMap.TryGetValue(ex, out map)) { map = new MethodCallStackArgumentMap(); map.FirstChanceFrameCount = frameCount; MethodArgumentsMap[ex] = map; } int lineIndex = map.FirstChanceFrameCount - frameCount; map[lineIndex] = call; } catch { } }
public void TrackArguments(Exception ex, object instance, params object[] args) { try { if (ex == null) { return; } MethodCallInfo call = new MethodCallInfo() { Instance = instance, Arguments = args }; StackTrace trace = new StackTrace(0, false); int frameCount = trace.FrameCount; if (frameCount > 0) { call.Method = trace.GetFrame(1).GetMethod(); } TrackArguments(ex, frameCount, call); } catch { } }
public void TrackArguments(Exception ex, MethodCallInfo call, int skipFrames = 1) { try { if (ex == null || call == null || call.Arguments == null || call.Arguments.Count <= 0) { return; } StackTrace trace = new StackTrace(0, false); int frameCount = trace.FrameCount; if (call.Method == null) { call.Method = trace.GetFrame(skipFrames).GetMethod(); } TrackArguments(ex, frameCount, call); } catch { } }