public TransactionMsg(CallingMethodInfo pCallingMethodInfo, string pAuditFolder) { instanceSequence = RbrClient.Instance.GetNextSequence(); AssemblyFullName = pCallingMethodInfo.AssemblyFullName; TypeFullName = pCallingMethodInfo.TypeFullName; MethodFullName = pCallingMethodInfo.FullName; Arguments = pCallingMethodInfo.MethodParameters; auditFolder = pAuditFolder; }
protected virtual void OpenFile(CallingMethodInfo data) { if (data == null) { return; } new OpenStackTraceFile { Column = data.CallingCol, Line = data.CallingLine, FullFilename = data.CallingFileFullName }.ShowToUser(); }
internal Transaction(IConnection pDbConnection) { completed = false; connection = pDbConnection; txMsg = null; grandParentCallingMethodInfo = StackInfo.Get(4); if (grandParentCallingMethodInfo == null) { throw new Exception("grandParentCallingMethodInfo == null"); } parentCallingMethodInfo = StackInfo.Get(3); if (parentCallingMethodInfo == null) { throw new Exception("parentCallingMethodInfo == null"); } }
private static bool isCustomDirectQuery(CallingMethodInfo info) { return(info.CallingMethod.Contains("ExecuteSqlCommand") || info.CallingMethod.Contains("ExecuteSqlQuery") || info.StackTrace.Contains("SessionImpl.ListCustomQuery")); }
private CallingMethodInfo getStackFrameInfo(StackFrame stackFrame, bool onlyIncludeInfoWithFileLine) { var methodInfo = new CallingMethodInfo { StackTrace = string.Empty }; if (stackFrame == null) { return(null); } var method = stackFrame.GetMethod(); if (method == null) { return(null); } var type = method.ReflectedType; if (type == null) { return(null); } var assemblyName = method.Module.Assembly.GetName().Name; if (_assembliesToExclude.Contains(assemblyName) || _methodsToExclude.Contains(method.Name) || shouldExcludeType(method) || isMicrosoftType(method)) { return(null); } var methodString = method.ToString(); var returnName = string.Empty; var methodSignature = methodString; var splitIndex = methodString.IndexOf(' '); if (splitIndex > 0) { returnName = methodString.Substring(0, splitIndex); methodSignature = methodString.Substring(splitIndex + 1, methodString.Length - splitIndex - 1); } var typeNameFull = type.FullName; var lineNumber = stackFrame.GetFileLineNumber(); var fileLine = string.Empty; var filePath = stackFrame.GetFileName(); if (isTempFile(filePath)) { return(null); } if (!string.IsNullOrEmpty(filePath)) { var fileName = Path.GetFileName(filePath); fileLine = string.Format("File={0}, Line={1}", fileName, lineNumber); methodInfo.CallingFile = fileName; methodInfo.CallingLine = lineNumber; methodInfo.CallingCol = stackFrame.GetFileColumnNumber(); methodInfo.CallingFileFullName = filePath; } //there is no valid .pdb file if (onlyIncludeInfoWithFileLine && !File.Exists(filePath)) { return(null); } //couldn't extract the source file name if (onlyIncludeInfoWithFileLine && string.IsNullOrWhiteSpace(fileLine)) { return(null); } var methodSignatureFull = string.Format("{0} {1}.{2}", returnName, typeNameFull, methodSignature); methodInfo.CallingMethod = method.Name; methodInfo.StackTrace = string.Format("{0}", methodSignatureFull); return(methodInfo); }