本文整理汇总了C#中System.Diagnostics.StackFrame.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# StackFrame.ToString方法的具体用法?C# StackFrame.ToString怎么用?C# StackFrame.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Diagnostics.StackFrame
的用法示例。
在下文中一共展示了StackFrame.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FaultStackFrame
/// <summary>
/// Creates a new instance of the <see cref="WcfRawJson.ErrorHandling.FaultStackFrame"/>
/// class from an existing <see cref="System.Diagnostics.StackFrame"/>.
/// </summary>
/// <param name="frame">
/// The <see cref="System.Diagnostics.StackFrame"/> object from which to derive this
/// <see cref="WcfRawJson.ErrorHandling.StackFrame"/>
/// </param>
public FaultStackFrame(StackFrame frame)
{
this.FileColumnNumber = frame.GetFileColumnNumber();
this.FileLineNumber = frame.GetFileLineNumber();
this.FileName = frame.GetFileName();
this.ILOffset = frame.GetILOffset();
this.Method = frame.GetMethod().ToString();
this.NativeOffset = frame.GetNativeOffset();
this.Description = frame.ToString();
}
示例2: TraceStackFrame
internal static void TraceStackFrame(int steps)
{
string name = null;
GetCurrentMethodName(2, ref name);
string trace = "";
for(int i=1;i<steps;i++)
{
System.Diagnostics.StackFrame sf = new System.Diagnostics.StackFrame(i, true);
trace += sf.ToString();
}
System.Diagnostics.Trace.WriteLine(trace, name);
System.Diagnostics.Trace.WriteLine("");
}
示例3: WriteDebugComment
private void WriteDebugComment()
{
if (Debugger.IsAttached)
{
var zed = new StackFrame(2, true);
_builder.WriteLine("// {0}", zed.ToString());
}
}
示例4: StackFrame_Path_Leak
public void StackFrame_Path_Leak ()
{
StackFrame sf = new StackFrame ("/path/to/the/source/file.cs", 1);
Assert.IsFalse (sf.ToString ().Contains ("path/to/the/source"), "no path leaked");
Assert.IsTrue (sf.ToString ().Contains ("file.cs"), "filename");
}
示例5: StackFrame_FileName_Leak
public void StackFrame_FileName_Leak ()
{
StackFrame sf = new StackFrame ("/path/to/the/source/file.cs", 1);
Assert.IsTrue (sf.ToString ().Contains ("<filename unknown>"), "no file name leaked");
}
示例6: GetCurrentLocation
public static string GetCurrentLocation(int skip_frames)
{
StackFrame sf = new StackFrame(skip_frames + 1, true);
return sf.ToString();
}