Debug with multiple files not working

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 8 years and 3 weeks 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.
User avatar
VCPIeng
Posts: 2
Last visit: Tue Jan 28, 2020 10:54 am

Debug with multiple files not working

Post by VCPIeng »

Product, version and build: PowerShell Studio 2016 [REMOVED BY MODERATOR]
32 or 64 bit version of product: 64
Operating system: Windows 7
32 or 64 bit OS: 64


I am trying to debug multiple files without success.
I have:
- A main file, with parameters and no functions
- 2 accessory files, with multiple functions (each function has parameters).

The main file dot sources the accessory files at the beginning and calls the functions as needed.
Now, everything works fine and dandy when I debug one file at a time.. as it prompts me for the parameters.
The issue arises if I try to debug all of them together. it never prompts for the parameters and quits the debug immediately.
Any ideas?

UPDATE: I found a way to run the main file in multi-file debug by using the call function in the project startup file Startup.pss:
Call-mainfile_ps1 -param1 "string1" -param2 "string2". So the main file runs and debugs.
The problem is that when it calls the dot sourced functions, it doesn't switch file to let me debug those functions - it just runs them and goes to the next breakpoint in the main file.
Of course the accessory files all have their breakpoints.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Debug with multiple files not working

Post by davidc »

For your own protection, please do not post your subscription number on the forums.

I'm assuming you are working in a project?

If you are working with a project and are dot sourcing ps1 files, make sure you mark the file's Build setting to Content.

1. Select the file in the project panel:
Project Pane.png
Project Pane.png (10.06 KiB) Viewed 1121 times
2. Then set the Build property in the Property Panel:
Project File Build.png
Project File Build.png (10.36 KiB) Viewed 1121 times
The file will no longer have a Call- function associated with the file and it will remain as is. Then you can debug the project using the normal Debug command instead of Debug with Multiple files command.

David
David
SAPIEN Technologies, Inc.
User avatar
VCPIeng
Posts: 2
Last visit: Tue Jan 28, 2020 10:54 am

Re: Debug with multiple files not working

Post by VCPIeng »

YES!! YES!!!!

You don't know how much headache this saves me in debugging, as I kep calling functions back and forth between files.

Many thanks.
This topic is 8 years and 3 weeks 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.