Export (0) Print
Expand All

StackTrace Constructor (Thread, Boolean)

Note: This API is now obsolete.

Initializes a new instance of the StackTrace class for a specific thread, optionally capturing source information.

Do not use this constructor overload.

Namespace:  System.Diagnostics
Assembly:  mscorlib (in mscorlib.dll)

[ObsoleteAttribute("This constructor has been deprecated.  Please use a constructor that does not require a Thread parameter.  http://go.microsoft.com/fwlink/?linkid=14202")]
public StackTrace(
	Thread targetThread,
	bool needFileInfo


Type: System.Threading.Thread

The thread whose stack trace is requested.

Type: System.Boolean

true to capture the file name, line number, and column number; otherwise, false.


The thread targetThread is not suspended.

Important noteImportant

Do not use this constructor. It is obsolete, and there is no recommended alternative. When you suspend a thread, you have no way of knowing what code it is executing, and deadlocks can occur very easily. For example, if you suspend a thread while it holds locks during a security permission evaluation, other threads in the AppDomain might be blocked. If you suspend a thread while it is executing a class constructor, other threads in the AppDomain that attempt to use that class are blocked.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0
Obsolete (compiler warning) in 4.6

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Obsolete (compiler warning) in Windows Phone 8.1

Obsolete (compiler warning) in Windows Phone Silverlight 8.1

Obsolete (compiler warning) in Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft