CallStackFrame Class

 

Updated: April 27, 2016

Applies To: Windows PowerShell

A call stack item returned by the Get-PSCallStack cmdlet.

This class is introduced in Windows PowerShell 2.0.

Namespace:   System.Management.Automation
Assembly:  System.Management.Automation (in System.Management.Automation.dll)

System.Object
  System.Management.Automation.CallStackFrame

public sealed class CallStackFrame

NameDescription
System_CAPS_pubmethodCallStackFrame(InvocationInfo)

Creates a new instance of the CallStackFrame class.

This element is introduced in Windows PowerShell 5.0.

NameDescription
System_CAPS_pubpropertyFunctionName

The name of the function associated with this frame.

Introduced in Windows PowerShell 3.0.

System_CAPS_pubpropertyInvocationInfo

The InvocationInfo of the command.

This property is introduced in Windows PowerShell 2.0.

System_CAPS_pubpropertyPosition

The position information for the current position in the frame. Null if the frame is not associated with a script.

Introduced in Windows PowerShell 3.0.

System_CAPS_pubpropertyScriptLineNumber

Line number of the current location, or 0 if the frame is not associated to a script.

This property is introduced in Windows PowerShell 2.0.

System_CAPS_pubpropertyScriptName

File name of the current location, or null if the frame is not associated to a script.

This property is introduced in Windows PowerShell 2.0.

NameDescription
System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_pubmethodGetFrameVariables()

Return a dictionary with the names and values of variables that are "local" to the frame.

Introduced in Windows PowerShell 3.0.

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetScriptLocation()

Returns a formatted string containing the ScriptName and ScriptLineNumber.

This method is introduced in Windows PowerShell 2.0.

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns the current instance as a string..

Introduced in Windows PowerShell 3.0.(Overrides Object.ToString().)

For example, the following is a script and its associated call stack. Notice that this call stack has four frames.

PS D:\scripts> cat .\MyScript.ps1
function f()
{
  Get-PSCallStack
}

function g()
{
  f
}

g
PS D:\nam\scripts> .\MyScript.ps1

Command        Arguments          Location         
-------        ---------          --------         
f              {}                 MyScript.ps1: Line 3
g              {}                 MyScript.ps1: Line 8
MyScript.ps1   {}                 MyScript.ps1: Line 11
prompt         {}                 prompt

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: