Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell 2 ISE, not stopping on breakpoints in imported modules

When we set breakpoints within a Module we've imported the debugger ignores the breakpoint. Has anybody else seen this behaviour?
This is driving me nuts, we use PowerShell Modules extensively.
The thing that's really weird is I can see the breakpoint if I run get-psbreakpoint

PS H:\Projects\Powershell> get-psbreakpoint | format-list -force


Id       : 0
Script   : H:\projects\Powershell\Shared\SFTP\SFTP.psm1
Line     : 25
Column   : 0
Enabled  : True
HitCount : 0
Action   : 

Id       : 1
Script   : H:\projects\Powershell\Trading\CPPIB\scripts\CppibBorrowReturns.ps1
Line     : 12
Column   : 0
Enabled  : True
HitCount : 1
Action   : 

EDIT: Seems to work if I delete the psd1 (Manifest file)

like image 787
David Hayes Avatar asked Jul 02 '10 19:07

David Hayes


1 Answers

Debugging modules can be tough. One way I have been able to do it is load both the module and the code that calls the function you are debugging. In the code that calls a function in the module, place a break point. Then when it its the call to the function in the module, step in to it. Once it steps into the module you should be able to hit F5 again to hit your break point in the module.

Sorry if that is not as clear as it should be, still reeling from day light savings on a Monday.

like image 95
Norman Skinner Avatar answered Nov 15 '22 08:11

Norman Skinner