Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,239 @@
2010-03-16 Jb Evain <jbevain@novell.com>
* StackFrame.cs: use MOONLIGHT symbol to disambiguate
MonoTouch and Moonlight code.
2010-03-07 Rodrigo Kumpera <rkumpera@novell.com>
* Debugger.cs: Add Obsolete attribute to .ctor().
2009-10-24 Sebastien Pouliot <sebastien@ximian.com>
* StackFrame.cs: Relax GetSecureFileName when the coreclr is not
active (i.e. show full path when compiling with smcs)
2009-10-08 Sebastien Pouliot <sebastien@ximian.com>
* StackFrame.cs: Introduce a new GetSecureFileName method that
will deal with CAS (regular framework) and will remove the path
(for Moonlight) on a stack frame.
* StackTrace.cs: Use the new StackFrame.GetSecureFileName to
simplify logic
2009-09-18 Sebastien Pouliot <sebastien@ximian.com>
* StackFrame.cs: Avoid imperative CAS checks for NET_2_1
2009-01-24 Zoltan Varga <vargaz@gmail.com>
* StackFrame.cs: Fix warnings.
2008-10-20 Cedric Vivier <cedricv@neonux.com>
* Debugger.cs: Implement Debugger.IsAttached
2008-04-03 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* StackTrace.cs: Fix parameter names
* DebuggerVisualizerAttribute.cs: Fix parameter names, fix wrong constructors (parameters
were incorrectly used, maybe result of the wrong parameter names),
remove unaccessible parameters, remove useless NET_2_0
2008-04-02 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* DebuggerTypeProxyAttribute.cs
* StackFrame.cs: Fix parameter names
2007-11-05 Sebastien Pouliot <sebastien@ximian.com>
* DebuggableAttribute.cs: Don't throw on DebuggingFlags property.
Fix part of #322850.
2007-05-16 Dick Porter <dick@ximian.com>
* ConditionalAttribute.cs:
* DebuggableAttribute.cs:
* Debugger.cs:
* DebuggerBrowsableAttribute.cs:
* DebuggerDisplayAttribute.cs:
* DebuggerHiddenAttribute.cs:
* DebuggerNonUserCodeAttribute.cs:
* DebuggerStepperBoundaryAttribute.cs:
* DebuggerStepThroughAttribute.cs:
* DebuggerTypeProxyAttribute.cs:
* DebuggerVisualizerAttribute.cs:
* StackFrame.cs:
* StackTrace.cs:
* DebuggerBrowsableState.cs: Update to 2.0 profile
2007-05-11 Rolf Bjarne Kvinge <RKvinge@novell.com>
* DebuggerDisplayAttribute.cs: Default Type, Name and Value is an empty string.
Fix name setter. Can't set a null TargetType, and use AssemblyQualifiedName
for the TargetTypeName.
2007-04-27 Zoltan Varga <vargaz@gmail.com>
* StackTrace.cs: Fix ToString () to be compatible with MS. Fixes #81207.
2006-07-24 Miguel de Icaza <miguel@novell.com>
* DebuggerDisplayAttribute.cs: Update the targets
2006-01-26 Zoltan Varga <vargaz@gmail.com>
* DebuggerNonUserCodeAttribute.cs: New file.
2005-12-16 Sebastien Pouliot <sebastien@ximian.com>
* StackTrace.cs: Added, if avilable, the filename/lineno debug
information in ToString() like it's done on the 2.0 framework (i.e.
Mono will display it for all profile, MS only in 2.0). Fix bug #75932.
2005-05-25 Zoltan Varga <vargaz@freemail.hu>
* StackTrace.cs: Add an internal ctor which skips unmanaged frames.
2005-04-16 Sebastien Pouliot <sebastien@ximian.com>
* StackFrame.cs: Moved documentation comments (XML) to monodoc.
Removed unused method ObjectsEqual.
2005-03-14 Sebastien Pouliot <sebastien@ximian.com>
* StackFrame.cs: Fix CAS unit tests for NET_1_1.
* StackTrace.cs: Fix CAS unit tests for NET_1_1.
2005-03-04 Zoltan Varga <vargaz@freemail.hu>
* StackFrame.cs: Add an internalMethodName field to return info about
the various runtime wrappers.
2005-03-02 Chris Toshok <toshok@ximian.com>
* DebuggerTypeProxyAttribute.cs, DebuggerBrowsableState.cs,
DebuggerDisplayAttribute.cs, DebuggerBrowsableAttribute: first cut
at 3/4 of the .net 2.0 debugger attributes.
2005-02-12 Marek Safar <marek.safar@seznam.cz>
* ConditionalAttribute.cs: NET_2_0 extension.
2005-01-27 Sebastien Pouliot <sebastien@ximian.com>
* StackFrame.cs: Add path discovery permission check for GetFilename
method. Changed ToString to use a StringBuilder and report correctly
(i.e. without exception) if filename is restricted. Removed dead code
(Equals/GetHashCode).
* StackTrace.cs: Removed dead code (Equals/GetHashCode).
2004-08-05 Sebastien Pouliot <sebastien@ximian.com>
* StackTrace.cs: Added missing exceptions. Added globalization. Now
using StringBuilder in ToString (fusioned FrameToString).
2004-08-04 Sebastien Pouliot <sebastien@ximian.com>
* StackTrace.cs: Implemented GetFrames as public virtual for NET_2_0
and internal for NET_1_0/NET_1_1 so it can be used for CAS. Removed
XML documentation and mono-ized the source code.
2004-06-15 Gert Driesen <drieseng@users.sourceforge.net>
* StackTrace.cs: added TODO for serialization
* StackFrame.cs: added TODO for serialization
2004-05-19 Gert Driesen (drieseng@users.sourceforge.net)
* DebuggerHiddenAttribute.cs
* DebuggerStepThroughAttribute.cs : now that Inherited is
false by default on AttributeUsageAttribute (as it
should be) we need to explicitly set Inherited to false
for those attributes where it should be false.
2003-09-18 Ravi Pratap <ravi@ximian.com>
* ConditionalAttribute.cs: AllowMultiple should be true according
to bug #48598.
2003-09-02 Ravi Pratap <ravi@ximian.com>
* DebuggerStepThroughAttribute.cs: Fix allowable targets to include class
and struct; remove property targets.
2003-07-01 Zoltan Varga <vargaz@freemail.hu>
* StackFrame.cs: Obtain frame info for 'fake' frames too, since this is
what MS does.
2003-01-01 Jaime Anguiano Olarra <jaime@gnome.org>
* Process.cs: skeleton for use in Remoting.
2002-06-19 Dietmar Maurer <dietmar@ximian.com>
* StackTrace.cs: impl. remaining constructors.
2002-06-18 Dietmar Maurer <dietmar@ximian.com>
* StackTrace.cs: use new internal call for constructors, use MS like
trace format.
* StackFrame.cs: impl. constructors using a new internal call.
2002-05-01 Duncan Mak <duncan@ximian.com>
* DebuggableAttribute.cs: Added missing AttributeUsage attribute.
2002-04-08 Jonathan Pryor <jonpryor@vt.edu>
* Debugger.cs: Added [MonoTODO] attribute to methods; modified IsLogging()
and Log() so that System.Diagnostics.DefaultTraceListener could use them
without having NotImplementedException's thrown, as the functionality
DefaultTraceListener is using is non-critical.
2002-04-08 Nick Drochak <ndrochak@gol.com>
* ConditionalAttribute.cs: Add AttributeUsage attribute for methods.
2002-01-23 Duncan Mak <duncan@ximian.com>
* DebuggerStepThroughAttribute.cs:
* DebuggerHiddenAttribte.cs: Add to CVS.
2002-01-04 Ravi Pratap <ravi@ximian.com>
* StackFrame.cs : Use the MonoTODO attribute to mark
incomplete code.
StackTrace.cs : Ditto.
2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
* Moved TraceListener, TextWriterTraceListener, and
DefaultTraceListener to System assembly....oops.
2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
* Added TextWriterTraceListener.cs, TraceListener.cs, and
DefaultTraceListener.cs to the build.
2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
* Added Debugger.cs to the build.
2001-09-02 Miguel de Icaza <miguel@ximian.com>
* Moved BooleanSwitch, Switch, TraceLevel and TraceSwitch to the
System assembly.
* Added StackFrame.cs and StackTrace.cs to the build.
2001-08-21 Nick Drochak <ndrochak@gol.com>
* Implemented ConditionalAttribute.cs and DebuggableAttribute.cs
2001-08-29 Alexander Klyubin <klyubin@aqris.com>
* Skeletal implementation of StackFrame and StackTrace classes.
The classes must be somehow connected to runtime environment in
order to generate proper traces.

View File

@@ -0,0 +1,59 @@
//
// ConditionalAttribute.cs
//
// Author:
// Nick Drochak II (ndrochak@gol.com)
//
// (C) 2001 Nick Drochak II
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.Diagnostics
{
[Serializable]
[AttributeUsage(
AttributeTargets.Class |
AttributeTargets.Method, AllowMultiple = true)]
[ComVisible (true)]
public sealed class ConditionalAttribute : System.Attribute
{
private string myCondition;
// Public Instance Constructors
public ConditionalAttribute(string conditionString)
{
myCondition = conditionString;
}
// Public Instance Properties
public string ConditionString { get { return myCondition; }
}
}
}

View File

@@ -0,0 +1,86 @@
//
// DebuggableAttribute.cs
//
// Author:
// Nick Drochak II (ndrochak@gol.com)
// Ben S. Stahlhood II (bstahlhood@gmail.com)
//
// (C) 2001 Nick Drochak II
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.Diagnostics {
[AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Module)]
[ComVisible (true)]
public sealed class DebuggableAttribute : System.Attribute {
private bool JITTrackingEnabledFlag;
private bool JITOptimizerDisabledFlag;
[Flags]
[ComVisible (true)]
public enum DebuggingModes {
// Fields
None = 0,
Default = 1,
IgnoreSymbolStoreSequencePoints = 2,
EnableEditAndContinue = 4,
DisableOptimizations = 256
}
private DebuggingModes debuggingModes = DebuggingModes.None;
public DebuggingModes DebuggingFlags {
get { return debuggingModes; }
}
// Public Instance Constructors
public DebuggableAttribute(bool isJITTrackingEnabled, bool isJITOptimizerDisabled)
{
JITTrackingEnabledFlag = isJITTrackingEnabled;
JITOptimizerDisabledFlag = isJITOptimizerDisabled;
if (isJITTrackingEnabled)
debuggingModes |= DebuggingModes.Default;
if (isJITOptimizerDisabled)
debuggingModes |= DebuggingModes.DisableOptimizations;
}
public DebuggableAttribute(DebuggingModes modes)
{
debuggingModes = modes;
JITTrackingEnabledFlag = (debuggingModes & DebuggingModes.Default) != 0;
JITOptimizerDisabledFlag = (debuggingModes & DebuggingModes.DisableOptimizations) != 0;
}
// Public Instance Properties
public bool IsJITTrackingEnabled { get { return JITTrackingEnabledFlag; } }
public bool IsJITOptimizerDisabled { get { return JITOptimizerDisabledFlag; } }
}
}

View File

@@ -0,0 +1,130 @@
//
// System.Diagnostics.Debugger.cs
//
// Author:
// John R. Hicks (angryjohn69@nc.rr.com)
//
// (C) 2001
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace System.Diagnostics
{
/// <summary>
/// Enables communication with a debugger.
/// </summary>
[ComVisible (true)]
[MonoTODO ("The Debugger class is not functional")]
public sealed class Debugger
{
/// <summary>
/// Represents the default category of a message with a constant.
/// </summary>
public static readonly string DefaultCategory = "";
/// <summary>
/// Returns a Boolean indicating whether a debugger is attached to a process.
/// </summary>
/// <value>
/// true if debugger is attached; otherwise, false.
/// </value>
public static bool IsAttached
{
get
{
return IsAttached_internal ();
}
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static bool IsAttached_internal ();
/// <summary>
/// Causes a breakpoint to be signaled to an attached debugger.
/// </summary>
public static void Break()
{
// The JIT inserts a breakpoint on the caller.
}
/// <summary>
/// Checks to see if logging is enabled by an attached debugger.
/// </summary>
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern bool IsLogging();
/// <summary>
/// Launches and attaches a debugger to the process.
/// </summary>
[MonoTODO ("Not implemented")]
public static bool Launch()
{
throw new NotImplementedException();
}
/// <summary>
/// Posts a message for the attached debugger.
/// </summary>
/// <param name="level">
/// A description of the importance of this message
/// </param>
/// <param name="category">
/// A string describing the category of this message.
/// </param>
/// <param name="message">
/// A string representing the message to show.
/// </param>
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern void Log(int level, string category, string message);
#if NET_4_0
public static void NotifyOfCrossThreadDependency ()
{
}
#endif
#if NET_4_0
[ObsoleteAttribute("Call the static methods directly on this type", true)]
#endif
public Debugger()
{
}
#if MONODROID
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static void Mono_UnhandledException_internal (Exception ex);
internal static void Mono_UnhandledException (Exception ex)
{
Mono_UnhandledException_internal (ex);
}
#endif
}
}

View File

@@ -0,0 +1,54 @@
//
// System.Diagnostics.DebuggerBrowsableAttribute.cs
//
// Author:
// Chris Toshok (toshok@novell.com)
//
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Diagnostics {
[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Property)]
[ComVisible (true)]
public sealed class DebuggerBrowsableAttribute : Attribute
{
DebuggerBrowsableState state;
public DebuggerBrowsableAttribute (DebuggerBrowsableState state) {
this.state = state;
}
public DebuggerBrowsableState State {
get {
return state;
}
}
}
}

View File

@@ -0,0 +1,43 @@
//
// System.Diagnostics.DebuggerDisplayAttribute.cs
//
// Author:
// Chris Toshok (toshok@novell.com)
//
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.Diagnostics {
// XXX make sure this matches MS's enum
[ComVisible (true)]
public enum DebuggerBrowsableState
{
Never = 0,
Collapsed = 2,
RootHidden = 3
}
}

View File

@@ -0,0 +1,108 @@
//
// System.Diagnostics.DebuggerDisplayAttribute.cs
//
// Author:
// Chris Toshok (toshok@novell.com)
//
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Diagnostics {
[AttributeUsageAttribute(AttributeTargets.Class |
AttributeTargets.Struct |
AttributeTargets.Enum |
AttributeTargets.Field |
AttributeTargets.Delegate |
AttributeTargets.Property |
AttributeTargets.Assembly, AllowMultiple=true)]
[ComVisible (true)]
public sealed class DebuggerDisplayAttribute : Attribute
{
string value, type, name;
string target_type_name;
Type target_type;
public DebuggerDisplayAttribute (string value) {
if (value == null)
value = string.Empty;
this.value = value;
this.type = string.Empty;
this.name = string.Empty;
}
public string Value {
get {
return value;
}
}
public Type Target {
get {
return target_type;
}
set {
if (value == null)
throw new ArgumentNullException ("value");
target_type = value;
target_type_name = target_type.AssemblyQualifiedName;
}
}
public string TargetTypeName {
get {
return target_type_name;
}
set {
target_type_name = value;
}
}
public string Type {
get {
return type;
}
set {
type = value;
}
}
public string Name {
get {
return name;
}
set {
name = value;
}
}
}
}

View File

@@ -0,0 +1,51 @@
//
// System.Diagnostics.DebuggerHiddenAttribute.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// (C) Ximian, Inc. http://www.ximian.com
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Diagnostics
{
[AttributeUsage (AttributeTargets.Constructor |
AttributeTargets.Method | AttributeTargets.Property,
Inherited=false)]
[Serializable]
[ComVisible (true)]
public sealed class DebuggerHiddenAttribute : Attribute
{
public DebuggerHiddenAttribute ()
: base ()
{
}
}
}

View File

@@ -0,0 +1,45 @@
//
// System.Diagnostics.DebuggerNonUserCodeAttribute.cs
//
// Author: Zoltan Varga (vargaz@gmail.com)
//
// (C) Ximian, Inc. http://www.ximian.com
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Diagnostics
{
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Property, Inherited=false)]
[ComVisibleAttribute(true)]
[Serializable]
public sealed class DebuggerNonUserCodeAttribute : Attribute
{
public DebuggerNonUserCodeAttribute () {
}
}
}

View File

@@ -0,0 +1,49 @@
//
// System.Diagnostics.DebuggerStepThroughAttribute.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// (C) Ximian, Inc. http://www.ximian.com
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Diagnostics
{
[AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct |
AttributeTargets.Constructor |
AttributeTargets.Method, Inherited=false)]
[Serializable]
[ComVisible (true)]
public sealed class DebuggerStepThroughAttribute : Attribute
{
public DebuggerStepThroughAttribute ()
: base ()
{
}
}
}

View File

@@ -0,0 +1,45 @@
//
// System.Diagnostics.DebuggerStepThroughAttribute.cs
//
// Author: Dick Porter (dick@ximian.com)
//
//
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Diagnostics
{
[Serializable]
[ComVisible (true)]
[AttributeUsage (AttributeTargets.Constructor|AttributeTargets.Method,
Inherited=false)]
public sealed class DebuggerStepperBoundaryAttribute : Attribute
{
public DebuggerStepperBoundaryAttribute ()
{
}
}
}

View File

@@ -0,0 +1,84 @@
//
// System.Diagnostics.DebuggerTypeProxyAttribute.cs
//
// Authors:
// Chris Toshok (toshok@novell.com)
// Marek Safar (marek.safar@gmail.com)
//
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Diagnostics {
[AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true)]
[ComVisible (true)]
public sealed class DebuggerTypeProxyAttribute : Attribute
{
string proxy_type_name;
string target_type_name;
Type target_type;
public DebuggerTypeProxyAttribute (string typeName) {
proxy_type_name = typeName;
}
public DebuggerTypeProxyAttribute (Type type)
{
if (type == null)
throw new ArgumentNullException ("type");
proxy_type_name = type.AssemblyQualifiedName;
}
public string ProxyTypeName {
get {
return proxy_type_name;
}
}
public Type Target {
get {
return target_type;
}
set {
target_type = value;
target_type_name = target_type.Name;
}
}
public string TargetTypeName {
get {
return target_type_name;
}
set {
target_type_name = value;
}
}
}
}

View File

@@ -0,0 +1,136 @@
//
// System.Diagnostics.DebuggerVisualizerAttribute.cs
//
// Author:
// Chris Toshok (toshok@novell.com)
//
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Diagnostics
{
[AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple=true)]
[ComVisible (true)]
public sealed class DebuggerVisualizerAttribute : Attribute
{
private string description;
private string visualizerSourceName;
private string visualizerName;
private string targetTypeName;
private Type target;
public DebuggerVisualizerAttribute (string visualizerTypeName)
{
this.visualizerName = visualizerTypeName;
}
public DebuggerVisualizerAttribute (Type visualizer)
{
if (visualizer == null)
throw new ArgumentNullException ("visualizer");
this.visualizerName = visualizer.AssemblyQualifiedName;
}
public DebuggerVisualizerAttribute (string visualizerTypeName, string visualizerObjectSourceTypeName)
{
this.visualizerName = visualizerTypeName;
this.visualizerSourceName = visualizerObjectSourceTypeName;
}
public DebuggerVisualizerAttribute (string visualizerTypeName, Type visualizerObjectSource)
{
if (visualizerObjectSource == null)
throw new ArgumentNullException ("visualizerObjectSource");
this.visualizerName = visualizerTypeName;
this.visualizerSourceName = visualizerObjectSource.AssemblyQualifiedName;
}
public DebuggerVisualizerAttribute (Type visualizer, string visualizerObjectSourceTypeName)
{
if (visualizer == null)
throw new ArgumentNullException ("visualizer");
this.visualizerName = visualizer.AssemblyQualifiedName;
this.visualizerSourceName = visualizerObjectSourceTypeName;
}
public DebuggerVisualizerAttribute (Type visualizer, Type visualizerObjectSource)
{
if (visualizer == null)
throw new ArgumentNullException ("visualizer");
if (visualizerObjectSource == null)
throw new ArgumentNullException ("visualizerObjectSource");
this.visualizerName = visualizer.AssemblyQualifiedName;
this.visualizerSourceName = visualizerObjectSource.AssemblyQualifiedName;
}
public string Description {
get {
return description;
}
set {
description = value;
}
}
public Type Target {
get {
return target;
}
set {
target = value;
targetTypeName = target.AssemblyQualifiedName;
}
}
public string TargetTypeName {
get {
return targetTypeName;
}
set {
targetTypeName = value;
}
}
// Debugged program-side type
public string VisualizerObjectSourceTypeName {
get {
return visualizerSourceName;
}
}
// Debugger-side type
public string VisualizerTypeName {
get {
return visualizerName;
}
}
}
}

View File

@@ -0,0 +1,198 @@
//
// System.Diagnostics.StackFrame.cs
//
// Author:
// Alexander Klyubin (klyubin@aqris.com)
// Dietmar Maurer (dietmar@ximian.com)
//
// (C) 2001
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Runtime.InteropServices;
namespace System.Diagnostics {
[Serializable]
[ComVisible (true)]
[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 MethodBase methodBase;
private string fileName;
private int lineNumber;
private int columnNumber;
#pragma warning disable 649
private string internalMethodName;
#pragma warning restore 649
#endregion
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern static bool get_frame_info (int skip, bool needFileInfo, out MethodBase method,
out int iloffset, out int native_offset,
out string file, out int line, out int column);
public StackFrame ()
{
get_frame_info (2, false, out methodBase, out ilOffset,
out nativeOffset, out fileName, out lineNumber,
out columnNumber);
}
public StackFrame (bool fNeedFileInfo)
{
get_frame_info (2, fNeedFileInfo, out methodBase, out ilOffset,
out nativeOffset, out fileName, out lineNumber,
out columnNumber);
}
public StackFrame (int skipFrames)
{
get_frame_info (skipFrames + 2, false, out methodBase, out ilOffset,
out nativeOffset, out fileName, out lineNumber,
out columnNumber);
}
public StackFrame (int skipFrames, bool fNeedFileInfo)
{
get_frame_info (skipFrames + 2, fNeedFileInfo, out methodBase, out ilOffset,
out nativeOffset, out fileName, out lineNumber,
out columnNumber);
}
// LAMESPEC: According to the MSDN docs, this creates a frame with _only_
// the filename and lineNumber, but MS fills out the frame info as well.
public StackFrame (string fileName, int lineNumber)
{
get_frame_info (2, false, out methodBase, out ilOffset,
out nativeOffset, out fileName, out lineNumber,
out columnNumber);
this.fileName = fileName;
this.lineNumber = lineNumber;
this.columnNumber = 0;
}
// LAMESPEC: According to the MSDN docs, this creates a frame with _only_
// the filename, lineNumber and colNumber, but MS fills out the frame info as well.
public StackFrame (string fileName, int lineNumber, int colNumber)
{
get_frame_info (2, false, out methodBase, out ilOffset,
out nativeOffset, out fileName, out lineNumber,
out columnNumber);
this.fileName = fileName;
this.lineNumber = lineNumber;
this.columnNumber = colNumber;
}
public virtual int GetFileLineNumber()
{
return lineNumber;
}
public virtual int GetFileColumnNumber()
{
return columnNumber;
}
public virtual string GetFileName()
{
#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;
}
public virtual MethodBase GetMethod ()
{
return methodBase;
}
public virtual int GetNativeOffset()
{
return nativeOffset;
}
internal string GetInternalMethodName ()
{
return internalMethodName;
}
public override string ToString ()
{
StringBuilder sb = new StringBuilder ();
if (methodBase == null) {
sb.Append (Locale.GetText ("<unknown method>"));
} else {
sb.Append (methodBase.Name);
}
sb.Append (Locale.GetText (" at "));
if (ilOffset == OFFSET_UNKNOWN) {
sb.Append (Locale.GetText ("<unknown offset>"));
} else {
sb.Append (Locale.GetText ("offset "));
sb.Append (ilOffset);
}
sb.Append (Locale.GetText (" in file:line:column "));
sb.Append (GetSecureFileName ());
sb.AppendFormat (":{0}:{1}", lineNumber, columnNumber);
return sb.ToString ();
}
}
}

View File

@@ -0,0 +1,238 @@
//
// System.Diagnostics.StackTrace.cs
//
// Author:
// Alexander Klyubin (klyubin@aqris.com)
// Dietmar Maurer (dietmar@ximian.com)
//
// (C) 2001
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections.Generic;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
namespace System.Diagnostics {
[Serializable]
[ComVisible (true)]
[MonoTODO ("Serialized objects are not compatible with .NET")]
public class StackTrace {
public const int METHODS_TO_SKIP = 0;
private StackFrame[] frames;
private bool debug_info;
public StackTrace ()
{
init_frames (METHODS_TO_SKIP, false);
}
public StackTrace (bool fNeedFileInfo)
{
init_frames (METHODS_TO_SKIP, fNeedFileInfo);
}
public StackTrace (int skipFrames)
{
init_frames (skipFrames, false);
}
public StackTrace (int skipFrames, bool fNeedFileInfo)
{
init_frames (skipFrames, fNeedFileInfo);
}
void init_frames (int skipFrames, bool fNeedFileInfo)
{
if (skipFrames < 0)
throw new ArgumentOutOfRangeException ("< 0", "skipFrames");
StackFrame sf;
var l = new List<StackFrame> ();
skipFrames += 2;
while ((sf = new StackFrame (skipFrames, fNeedFileInfo)) != null &&
sf.GetMethod () != null) {
l.Add (sf);
skipFrames++;
};
debug_info = fNeedFileInfo;
frames = l.ToArray ();
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern static StackFrame [] get_trace (Exception e, int skipFrames, bool fNeedFileInfo);
public StackTrace (Exception e)
: this (e, METHODS_TO_SKIP, false)
{
}
public StackTrace (Exception e, bool fNeedFileInfo)
: this (e, METHODS_TO_SKIP, fNeedFileInfo)
{
}
public StackTrace (Exception e, int skipFrames)
: this (e, skipFrames, false)
{
}
public StackTrace (Exception e, int skipFrames, bool fNeedFileInfo)
: this (e, skipFrames, fNeedFileInfo, false)
{
}
internal StackTrace (Exception e, int skipFrames, bool fNeedFileInfo, bool returnNativeFrames)
{
if (e == null)
throw new ArgumentNullException ("e");
if (skipFrames < 0)
throw new ArgumentOutOfRangeException ("< 0", "skipFrames");
frames = get_trace (e, skipFrames, fNeedFileInfo);
if (!returnNativeFrames) {
bool resize = false;
for (int i = 0; i < frames.Length; ++i)
if (frames [i].GetMethod () == null)
resize = true;
if (resize) {
var l = new List<StackFrame> ();
for (int i = 0; i < frames.Length; ++i)
if (frames [i].GetMethod () != null)
l.Add (frames [i]);
frames = l.ToArray ();
}
}
}
public StackTrace (StackFrame frame)
{
this.frames = new StackFrame [1];
this.frames [0] = frame;
}
[MonoLimitation ("Not possible to create StackTraces from other threads")]
#if NET_4_5
[Obsolete]
#endif
public StackTrace (Thread targetThread, bool needFileInfo)
{
if (targetThread == Thread.CurrentThread){
init_frames (METHODS_TO_SKIP, needFileInfo);
return;
}
throw new NotImplementedException ();
}
public virtual int FrameCount {
get {
return (frames == null) ? 0 : frames.Length;
}
}
public virtual StackFrame GetFrame (int index)
{
if ((index < 0) || (index >= FrameCount)) {
return null;
}
return frames [index];
}
[ComVisibleAttribute (false)]
public virtual StackFrame[] GetFrames ()
{
return frames;
}
public override string ToString ()
{
string newline = String.Format ("{0} {1} ", Environment.NewLine, Locale.GetText ("at"));
string unknown = Locale.GetText ("<unknown method>");
string debuginfo = Locale.GetText (" in {0}:line {1}");
StringBuilder sb = new StringBuilder ();
for (int i = 0; i < FrameCount; i++) {
StackFrame frame = GetFrame (i);
if (i > 0)
sb.Append (newline);
else
sb.AppendFormat (" {0} ", Locale.GetText ("at"));
MethodBase method = frame.GetMethod ();
if (method != null) {
// Method information available
sb.AppendFormat ("{0}.{1}", method.DeclaringType.FullName, method.Name);
/* Append parameter information */
sb.Append ("(");
ParameterInfo[] p = method.GetParametersInternal ();
for (int j = 0; j < p.Length; ++j) {
if (j > 0)
sb.Append (", ");
Type pt = p[j].ParameterType;
bool byref = pt.IsByRef;
if (byref)
pt = pt.GetElementType ();
if (pt.IsClass && pt.Namespace != String.Empty) {
sb.Append (pt.Namespace);
sb.Append (".");
}
sb.Append (pt.Name);
if (byref)
sb.Append (" ByRef");
sb.AppendFormat (" {0}", p [j].Name);
}
sb.Append (")");
}
else {
// Method information not available
sb.Append (unknown);
}
if (debug_info) {
// we were asked for debugging informations
// but that doesn't mean we have the debug information available
string fname = frame.GetSecureFileName ();
if (fname != "<filename unknown>")
sb.AppendFormat (debuginfo, fname, frame.GetFileLineNumber ());
}
}
return sb.ToString ();
}
}
}