using System.Security;
using System.Security.Permissions;
using System.Text;
-
-#if NET_2_0
using System.Runtime.InteropServices;
-#endif
namespace System.Diagnostics {
[Serializable]
-#if NET_2_0
[ComVisible (true)]
-#endif
[MonoTODO ("Serialized objects are not compatible with MS.NET")]
+ [StructLayout (LayoutKind.Sequential)]
public class StackFrame {
public const int OFFSET_UNKNOWN = -1;
#region Keep in sync with object-internals.h
private int ilOffset = OFFSET_UNKNOWN;
private int nativeOffset = OFFSET_UNKNOWN;
+ private long methodAddress;
+ private uint methodIndex;
private MethodBase methodBase;
private string fileName;
private int lineNumber;
public virtual string GetFileName()
{
-#if NET_2_0
+#if !NET_2_1
if (SecurityManager.SecurityEnabled && (fileName != null) && (fileName.Length > 0)) {
string fn = Path.GetFullPath (fileName);
new FileIOPermission (FileIOPermissionAccess.PathDiscovery, fn).Demand ();
#endif
return fileName;
}
+
+ internal string GetSecureFileName ()
+ {
+ string filename = "<filename unknown>";
+ if (fileName == null)
+ return filename;
+ try {
+ filename = GetFileName ();
+ }
+ catch (SecurityException) {
+ // CAS check failure
+ }
+ return filename;
+ }
public virtual int GetILOffset()
{
return ilOffset;
}
-#if ONLY_1_1
- [ReflectionPermission (SecurityAction.Demand, TypeInformation = true)]
-#endif
public virtual MethodBase GetMethod ()
{
return methodBase;
return nativeOffset;
}
+ internal long GetMethodAddress ()
+ {
+ return methodAddress;
+ }
+
+ internal uint GetMethodIndex ()
+ {
+ return methodIndex;
+ }
+
internal string GetInternalMethodName ()
{
return internalMethodName;
}
sb.Append (Locale.GetText (" in file:line:column "));
-
- if (fileName == null) {
- sb.Append (Locale.GetText ("<filename unknown>"));
- } else {
- try {
- sb.Append (GetFileName ());
- }
- catch (SecurityException) {
- sb.Append (Locale.GetText ("<filename unknown>"));
- }
- }
-
+ sb.Append (GetSecureFileName ());
sb.AppendFormat (":{0}:{1}", lineNumber, columnNumber);
return sb.ToString ();
}