22 private string strFileName;
24 private int iLineNumber;
26 private int iColumnNumber;
29 private bool fIsLastFrameFromForeignExceptionStackTrace;
34 internal void InitMembers()
42 fIsLastFrameFromForeignExceptionStackTrace =
false;
49 BuildStackFrame(0, fNeedFileInfo:
false);
58 BuildStackFrame(0, fNeedFileInfo);
66 BuildStackFrame(skipFrames + 0, fNeedFileInfo:
false);
76 BuildStackFrame(skipFrames + 0, fNeedFileInfo);
79 internal StackFrame(
bool DummyFlag1,
bool DummyFlag2)
90 BuildStackFrame(0, fNeedFileInfo:
false);
91 strFileName = fileName;
92 iLineNumber = lineNumber;
100 public StackFrame(
string fileName,
int lineNumber,
int colNumber)
103 BuildStackFrame(0, fNeedFileInfo:
false);
104 strFileName = fileName;
105 iLineNumber = lineNumber;
106 iColumnNumber = colNumber;
109 internal virtual void SetMethodBase(
MethodBase mb)
114 internal virtual void SetOffset(
int iOffset)
119 internal virtual void SetILOffset(
int iOffset)
124 internal virtual void SetFileName(
string strFName)
126 strFileName = strFName;
129 internal virtual void SetLineNumber(
int iLine)
134 internal virtual void SetColumnNumber(
int iCol)
136 iColumnNumber = iCol;
139 internal virtual void SetIsLastFrameFromForeignExceptionStackTrace(
bool fIsLastFrame)
141 fIsLastFrameFromForeignExceptionStackTrace = fIsLastFrame;
144 internal virtual bool GetIsLastFrameFromForeignExceptionStackTrace()
146 return fIsLastFrameFromForeignExceptionStackTrace;
172 [SecuritySafeCritical]
175 if (strFileName !=
null)
179 fileIOPermission.
Demand();
195 return iColumnNumber;
200 [SecuritySafeCritical]
210 stringBuilder.
Append(
"<");
213 for (; i < genericArguments.Length; i++)
217 stringBuilder.
Append(
",");
223 stringBuilder.
Append(genericArguments[i].Name);
225 stringBuilder.
Append(
">");
227 stringBuilder.
Append(
" at offset ");
230 stringBuilder.
Append(
"<offset unknown>");
234 stringBuilder.
Append(offset);
236 stringBuilder.
Append(
" in file:line:column ");
237 bool flag2 = strFileName !=
null;
244 fileIOPermission.
Demand();
253 stringBuilder.
Append(
"<filename unknown>");
257 stringBuilder.
Append(strFileName);
259 stringBuilder.
Append(
":");
260 stringBuilder.
Append(iLineNumber);
261 stringBuilder.
Append(
":");
262 stringBuilder.
Append(iColumnNumber);
266 stringBuilder.
Append(
"<null>");
272 private void BuildStackFrame(
int skipFrames,
bool fNeedFileInfo)
274 using (StackFrameHelper stackFrameHelper =
new StackFrameHelper(
null))
276 stackFrameHelper.InitializeSourceInfo(0, fNeedFileInfo,
null);
277 int numberOfFrames = stackFrameHelper.GetNumberOfFrames();
278 skipFrames +=
StackTrace.CalculateFramesToSkip(stackFrameHelper, numberOfFrames);
279 if (numberOfFrames - skipFrames > 0)
281 method = stackFrameHelper.GetMethodBase(skipFrames);
282 offset = stackFrameHelper.GetOffset(skipFrames);
283 ILOffset = stackFrameHelper.GetILOffset(skipFrames);
286 strFileName = stackFrameHelper.GetFilename(skipFrames);
287 iLineNumber = stackFrameHelper.GetLineNumber(skipFrames);
288 iColumnNumber = stackFrameHelper.GetColumnNumber(skipFrames);
static string NewLine
Gets the newline string defined for this environment.
Describes a set of security permissions applied to code. This class cannot be inherited.
FileIOPermissionAccess
Specifies the type of file access requested.
unsafe override string ToString()
Converts the value of this instance to a T:System.String.
Discovers the attributes of a method and provides access to method metadata.
StackFrame(string fileName, int lineNumber)
Initializes a new instance of the T:System.Diagnostics.StackFrame class that contains only the given ...
Represents a stack trace, which is an ordered collection of one or more stack frames.
StackFrame(string fileName, int lineNumber, int colNumber)
Initializes a new instance of the T:System.Diagnostics.StackFrame class that contains only the given ...
virtual int GetFileColumnNumber()
Gets the column number in the file that contains the code that is executing. This information is typi...
virtual Type [] GetGenericArguments()
Returns an array of T:System.Type objects that represent the type arguments of a closed generic type ...
SecurityAction
Specifies the security actions that can be performed using declarative security.
Provides information about, and means to manipulate, the current environment and platform....
StringBuilder Append(char value, int repeatCount)
Appends a specified number of copies of the string representation of a Unicode character to this inst...
virtual int GetILOffset()
Gets the offset from the start of the Microsoft intermediate language (MSIL) code for the method that...
StackFrame(int skipFrames)
Initializes a new instance of the T:System.Diagnostics.StackFrame class that corresponds to a frame a...
override string ToString()
Builds a readable representation of the stack trace.
StackFrame(bool fNeedFileInfo)
Initializes a new instance of the T:System.Diagnostics.StackFrame class, optionally capturing source ...
virtual int GetNativeOffset()
Gets the offset from the start of the native just-in-time (JIT)-compiled code for the method that is ...
Represents type declarations: class types, interface types, array types, value types,...
virtual MethodBase GetMethod()
Gets the method in which the frame is executing.
Provides information about methods and constructors.
StackFrame(int skipFrames, bool fNeedFileInfo)
Initializes a new instance of the T:System.Diagnostics.StackFrame class that corresponds to a frame a...
virtual int GetFileLineNumber()
Gets the line number in the file that contains the code that is executing. This information is typica...
FileIOPermissionAccess AllFiles
Gets or sets the permitted access to all files.
abstract string Name
Gets the name of the current member.
Represents a mutable string of characters. This class cannot be inherited.To browse the ....
void Demand()
Forces a T:System.Security.SecurityException at run time if all callers higher in the call stack have...
PermissionState
Specifies whether a permission should have all or no access to resources at creation.
Specifies that the class can be serialized.
const int OFFSET_UNKNOWN
Defines the value that is returned from the M:System.Diagnostics.StackFrame.GetNativeOffset or M:Syst...
Provides information about a T:System.Diagnostics.StackFrame, which represents a function call on the...
StackFrame()
Initializes a new instance of the T:System.Diagnostics.StackFrame class.
Controls the ability to access files and folders. This class cannot be inherited.
The exception that is thrown when a security error is detected.
virtual string GetFileName()
Gets the file name that contains the code that is executing. This information is typically extracted ...