0

Can a conditional breakpoint be set on a $_.member value? I am using the following expression, but the breakpoint is never hit. The $_ structure comes from a database record. I know that the 'auser' value is in the data.

{if ($_.LoginName -match 'auser') {break}}

I have structured this expression after the example at https://info.sapien.com/index.php/how-to/powershell-studio-howto/setting-conditional-breakpoints#:~:text=To%20set%20a%20conditional%20breakpoint%3A%20When%20creating%20or,instead%20of%20breaking%20%28not%20in%20addition%20to%20breaking%29.

lit
  • 14,456
  • 10
  • 65
  • 119
  • @AdminOfThings, I take it back. It hit a different breakpoint. After removing the second RIGHT PARENTHESIS character, it still fails to hit the breakpoint. – lit Sep 02 '21 at 17:29
  • Why is this `if` inside a scriptblock? Can you show more of the script? – Theo Sep 02 '21 at 17:46
  • Are you talking about [this](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/set-psbreakpoint?view=powershell-7.1#example-5--set-a-breakpoint-depending-on-the-value-of-a-variable) syntax? How and with what do you execute your code? – stackprotector Sep 02 '21 at 18:18
  • I tested this a few ways. Using `$_` or `$psitem` just seems to not work. Using other variable names doesn't seem to have issues for me. – AdminOfThings Sep 02 '21 at 18:38
  • @Theo, this is the entire expression scriptblock. I based it on the Sapien article mentioned in the question. – lit Sep 02 '21 at 20:55
  • @stackprotector, I am using Visual Studio Code for debugging as suggested by the `vscode-debugger` tag. – lit Sep 02 '21 at 20:57

0 Answers0