Visual Studio Code- how do I debug a loaded module?

Julian Milano 1 Reputation point
2024-11-14T00:31:14.0066667+00:00

In Powershell ISE, I was able to open a function code module in the ISE, set a breakpoint, in the command line window below, dot source the function code, then run the function from the ISE command line with parameters and was able to debug the function.

I tried the same thing in VSC however it does not recognise the breakpoint when the function is run from the Terminal window. Is this possible?

My source for the module is this: https://knowledge.broadcom.com/external/article?articleNumber=370419

For some strange reason when I try with the Broadcom supplied module, my ISE crashes to the desktop, even when run as an administrator so I'm forced to use VSC.

I tried to load the module in VSC and set a breakpoint and was expecting to run the module from the VSC command line and for the code execution to stop at the breakpoint however it did not and thus I cannot debug the function code.

PS C:\Users\jmilano\Documents\PowerShell_Scripts\Bulk_License_Update-v1.0> Get-PowerCLIVersion WARNING: The cmdlet "Get-PowerCLIVersion" is deprecated. Please use the 'Get-Module' cmdlet instead.

PowerCLI Version VMware.PowerCLI 13.1.0 build 21624340 Component Versions

VMware Common PowerCLI Component 13.2 build 22643733 VMware Cis Core PowerCLI Component PowerCLI Component 13.2 build 22643734 VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 13.1 build 21606170

PS C:\Users\jmilano\Documents\PowerShell_Scripts\Bulk_License_Update-v1.0> $PSVersionTable

Name Value


PSVersion 7.4.5 PSEdition Core GitCommitId 7.4.5 OS Microsoft Windows 10.0.20348 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

PS C:\Temp> $PSVersionTable

Name Value


PSVersion 5.1.20348.2760 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.20348.2760 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1

Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
1,006 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 31,606 Reputation points Microsoft Vendor
    2024-11-14T05:48:23.82+00:00

    Hello @Julian Milano ,

    Thank you for taking time to post this issue in Microsoft Q&A forum.

    As Visual Studio Code(VS Code) is different from Visual Studio(VS IDE), and currently VS Code is not supported in the Microsoft Q&A forums, please kindly post your question on Github - vscode for better help.

    Thanks for your understanding, have a great day!

    Sincerely,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.