Debug PowerShell with and without VS Code

preview_player
Показать описание
In this video I walk through how to debug PowerShell code using VS Code native features and the native PowerShell debugger.

00:00 Introduction
03:38 Sample project
06:00 Adding breakpoints
07:05 Using the debugger
08:40 Step into and over
13:55 Demo code walk through
16:30 Function breakpoints
22:10 Get-PSBreakpoint
24:40 Expression and hit count breakpoints
29:10 Call stack
30:03 Create breakpoint from powershell
31:00 Native PowerShell debugging
35:27 Mixing commands together
39:55 Summary and close
Рекомендации по теме
Комментарии
Автор

Thanks for this John. I've been using VSCode and PowerShell together for a while now but never bothered to explore the debugging options. Really useful and well explained as usual.

Pcketfullfsunshine
Автор

Great video John. Thanks for explaining the debug concept so well. The Breakpoint Debug Expression/Hit Count was new to me. This definitely helps. Thanks again!!

edwinpaul
Автор

Excellent, one of the best videos that I have ever seen.

OurstPlanet
Автор

Nice one John. Enjoyed the content. All the best.

sirsquirrel
Автор

Thanks for this. I knew there was a debugger in VS Code but I had problems with getting it to do what I expected when I first switched and never went back to it. Now I'll give it another shot.

MallocArray
Автор

I predicted that this video was coming.

Excellent approach and examples, as always :)

maxhax
Автор

Very easy and helpful demo. Thanks John!

ZivRivkis
Автор

Good stuff John! I learnt a couple of new things today! I never really used the power of step over, step out before! Now watching you do it was like an 'aha!' moment. I feel so dumb not using it before!! Conditional breakpoints are very common in .NET, I super psyched to see PowerShell/vscode supporting this.

Thanks again John, I have shared this video with my friends :)

iamdedlok
Автор

That was great! So far I used it just from time to time, but I think this video just bumped up my confidence to prefer this method. It is way more efficient!

psymonious
Автор

I'm a newbe... And after the video, I had the feeling to be an expert, I'm not :-) Great video, everything needed for a sound start. Congrat !

jcgermain
Автор

i know 2 guys from usa and both of them are powershell coders and power-lifters or ironmans in spare time what a coincidence - or fact that all powershell guys doin power-trainings also ? its good that myth is falling and become untrue - to being coder is to be unhealthy zombie attached to monitor whole day :D Great stuff dude 'kalokagathians' still exists! :)greetings from slovakia and cheers to all power-people :)

mackarof
Автор

Well done. Nice and concise!

Although I would have to say; I wouldn't bet on scissors, the odds would be against me!!! In other words; you have another bug (not that the steps you provided would help much with this one. It needs more of a unit test approach). -Maximum doesn't do what one (me for sure) might assume:

1..1000 | % {Get-Random -Minimum 1 -Maximum 9} | group | select name, count

danamatt
Автор

This came in very handy the other day in debugging a foreach loop that was giving a bad value every 7th user in the loop.

gopeisho
Автор

Good Video John, Although I spent the first 20 minutes wondering when you were going to start inputting your choice i.e. playing against the code :P

kristurk
Автор

Do you think Microsoft might fully remove powershell from Windows 10 in future versions? In favour of ps 7 and vs code.

jackgleeson