[Repeat] Debugger.Launch() in PowerShell

I decided to put the stuff here again as I found it is useful to extract the most important part from there

Whole article

Important (for me) part of the article

Add the following code to your PowerShell profile.

function Invoke-Debugger{}
New-Alias id Invoke-Debugger
$null = Set-PSBreakPoint –Command Invoke-Debugger

Now you can set breakpoints from code itself.

Just write

function MyFunction()
    # or even simplier

You will get to the breakpoint you set and you can debug it, see callstack, fetch local variables etc…


About mnaoumov

Senior .NET Developer in Readify
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

One Response to [Repeat] Debugger.Launch() in PowerShell

  1. Pingback: WTF: PowerShell 3 & Cygwin | mnaoumov.NET

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s