Dot Sourcing and Debug Break Points

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 1 year and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
tsugacanadensis
Posts: 7
Last visit: Tue Feb 06, 2024 4:09 am

Dot Sourcing and Debug Break Points

Post by tsugacanadensis »

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product: PowerShell Studio 2022 (64 Bit)
Build: v5.8.213
OS: Windows 10 Pro (64 Bit)
Version: v10.0.19044.0PowerShell

*** Please add details and screenshots as needed below. ***

DO NOT POST LICENSES, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM

Break points set inside a file that is dot sourced into an application are not honored when run in the debugger.
Break points set in the main form are honored.

Is this a bug or do I not understand the limitations of the debugger?

I've attached a sample test project.
-James
Attachments
Test.zip
Test Project
(23.16 KiB) Downloaded 160 times
User avatar
brittneyr
Site Admin
Posts: 1669
Last visit: Fri Apr 12, 2024 2:35 pm
Answers: 39
Been upvoted: 31 times

Re: Dot Sourcing and Debug Break Points

Post by brittneyr »

Can you please answer the following:
Do you see all breakpoints listed in the Tools Output panel when you start debugging?
Is the file apart of the project?
Are you using V5 or V7? If you are using PowerShell 7, what version?
Brittney
SAPIEN Technologies, Inc.
tsugacanadensis
Posts: 7
Last visit: Tue Feb 06, 2024 4:09 am

Re: Dot Sourcing and Debug Break Points

Post by tsugacanadensis »

I set two break points. One in the main form and the other in the include file.
I am using powershell version 5.
Two break points are set in the Tools Output.

See the attached images.

Thanks for the quick followup.
-James
Attachments
Tools Output.png
Tools Output.png (27.33 KiB) Viewed 8320 times
PSVersion.png
PSVersion.png (15.41 KiB) Viewed 8320 times
User avatar
brittneyr
Site Admin
Posts: 1669
Last visit: Fri Apr 12, 2024 2:35 pm
Answers: 39
Been upvoted: 31 times

Re: Dot Sourcing and Debug Break Points

Post by brittneyr »

You don't need to dot source the file since you have it included in the project. If you change the Shared property of your MoreBirds.ps1 file to true, it should work as expected.

I believe it's getting confused as you have the file included in the project along with the dot sourcing.

For more information on project file settings, the following article may be helpful:
https://www.sapien.com/blog/2022/03/15/ ... roduction/
Brittney
SAPIEN Technologies, Inc.
tsugacanadensis
Posts: 7
Last visit: Tue Feb 06, 2024 4:09 am

Re: Dot Sourcing and Debug Break Points

Post by tsugacanadensis »

Thank you for the project file settings documentation.

I commented out the dot sourced script.

I enabled the "Shared" property and the debugger is working as expected.

Thanks for your help with this.
-James
This topic is 1 year and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.