开发者

Powershell 2 ISE, not stopping on breakpoints in imported modules

开发者 https://www.devze.com 2023-01-06 08:17 出处:网络
When we set breakpoints within a Module we\'ve imported the debugger ignores the breakpoint. Has anybody else seen this behaviour?

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
Colum开发者_JS百科n   : 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)


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消