# Breackpoints "Stuck" in script?

**URL:** <https://forums.powershell.org/t/breackpoints-stuck-in-script/22086>\
**Category:** PowerShell Help\
**Created:** [April 9, 2023, 4:36pm UTC](https://forums.powershell.org/t/breackpoints-stuck-in-script/22086 "2023-04-09T16:36:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![DaddyKong](https://avatars.discourse-cdn.com/v4/letter/d/ccd318/32.png) [@DaddyKong](https://forums.powershell.org/u/DaddyKong)\
**Post date:** [April 9, 2023, 4:36pm UTC](https://forums.powershell.org/t/breackpoints-stuck-in-script/22086/1 "2023-04-09T16:36:42Z")

</div>

I ran a debugger on a script via Windows PowerShell ISE with breakpoints.  
After this, when running from PowerShell.exe (not ISE), the script hangs.  
I created a minidump (using ProcExplorer) and analyzed (using windbg.exe).  
Analysis shows that it is stopped at a breakpoint!  
However, I have no breakpoints set in my powershell session, nor do any show up if I re-open the script in ISE.  
I’ve tried restarting the server, aggressively clearing breakpoints via PS-_breakpoint_ commands, and even deleting the file and then re-creating it from a copy I’d pasted into notepad++.

Any thoughts or advise? This seems like an ISE internals thing, or something in the way PowerShell stores breakpoints.

```auto
EXCEPTION_RECORD: (.exr -1)
ExceptionAddress: 0000000000000000
   ExceptionCode: 80000003 (Break instruction exception)
  ExceptionFlags: 00000000
NumberParameters: 0

FAULTING_THREAD: 00002e2c

PROCESS_NAME: powershell.exe

ERROR_CODE: (NTSTATUS) 0x80000003 - {EXCEPTION} Breakpoint A breakpoint has been reached.

EXCEPTION_CODE_STR: 80000003

```

The actual command it seems to be hanging on is this:

```auto
$Matches = $DMLFileContents | Select-String ("INSERT.*?INTO.*?DATAFIX_METADATA.*?;") -AllMatches | % { $_.Matches } | % { $_.Value }

```

---

<div class="post-metadata">

**Author:** ![tonyd](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/tonyd/32/1041_2.png) [@tonyd](https://forums.powershell.org/u/tonyd)\
**Post date:** [April 10, 2023, 4:26pm UTC](https://forums.powershell.org/t/breackpoints-stuck-in-script/22086/2 "2023-04-10T16:26:09Z")

</div>

One thought … have you tried using Visual Studio Code ??

---

<div class="post-metadata">

**Author:** ![neemobeer](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/neemobeer/32/4087_2.png) [@neemobeer](https://forums.powershell.org/u/neemobeer)\
**Post date:** [April 10, 2023, 6:11pm UTC](https://forums.powershell.org/t/breackpoints-stuck-in-script/22086/3 "2023-04-10T18:11:17Z")

</div>

In Powershell.exe they are only stored per session unless you create some code to pre-load breakpoints. ISE probably saves them in a file to pre-load into the console session. I do not know where they are stored on the system but should be removal from ISE

---

<div class="post-metadata">

**Author:** ![DaddyKong](https://avatars.discourse-cdn.com/v4/letter/d/ccd318/32.png) [@DaddyKong](https://forums.powershell.org/u/DaddyKong)\
**Post date:** [April 10, 2023, 7:24pm UTC](https://forums.powershell.org/t/breackpoints-stuck-in-script/22086/4 "2023-04-10T19:24:44Z")

</div>

I had not! I’ll try that and see if it reveals anything. Actually, I think even Visual Studio 2022 has powershell extensions that might tell me something. Thanks!

---

<div class="post-metadata">

**Author:** ![DaddyKong](https://avatars.discourse-cdn.com/v4/letter/d/ccd318/32.png) [@DaddyKong](https://forums.powershell.org/u/DaddyKong)\
**Post date:** [April 10, 2023, 7:25pm UTC](https://forums.powershell.org/t/breackpoints-stuck-in-script/22086/5 "2023-04-10T19:25:18Z")

</div>

Thanks, neemobeer. I’ll investigate in that direction.

---

<div class="post-metadata">

**Author:** ![DaddyKong](https://avatars.discourse-cdn.com/v4/letter/d/ccd318/32.png) [@DaddyKong](https://forums.powershell.org/u/DaddyKong)\
**Post date:** [April 11, 2023, 6:25pm UTC](https://forums.powershell.org/t/breackpoints-stuck-in-script/22086/6 "2023-04-11T18:25:40Z")

</div>

I noticed a warning in VSCode (Thanks for the suggestion, tonyd) because I was assigning results to $Matches, which appears to be a reserved variable that is used when you use the -match function on a string.  
I rewrote the select-string to use {string} -match, and it’s working again.  
Good enough is, I guess ¯\_(ツ)\_/¯  
Thanks.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:14pm UTC](https://forums.powershell.org/t/breackpoints-stuck-in-script/22086/7 "2024-05-16T20:14:56Z")

</div>

Closed on May 16, 2024, 8:14pm UTC


