You can also access runspace of every installed and loaded PowerShell extension via Get-Runspace cmdlet. $PlayniteRunspace which is PowerShell runspace running in Playnite process dedicated to this interactive "playground".Remove All Breakpoints: If you think you might want to use it again, consider disabling the Breakpoint instead. $PlayniteApi which is an instance of Playnite API object. Note: Here are some additional tasks that can be performed while debugging your PowerShell script.To get Playnite API object use CTRL-V shortcut and ENTER (there's currently no better way how to do this, sadly). This will open PowerShell console connected to Playnite process and initialize new runspace for this interactive session. You can start PowerShell instance with pre-loaded Playnite SDK from main menu -> extensions. The Playnite interface will appear frozen while the debugger is paused on a breakpoint. You may also interactively inspect local variables and their properties. For example, you can use the $PlayniteAPI variable to interactively develop and test code. Typing into the PowerShell ISE console will evaluate statements in the current context. When you are finished debugging, run to the end of the script and the deployment will be complete. You can step through the script using F10 to step over and F11 to step in. PowerShell ISE will open a window showing the script currently executing on the remote machine. When the breakpoint is reached, hover over any variable names to see their current value. Enter-PSHostProcess -Id 3720 Debug-Runspace -Id 2. Set breakpoints using Debug > Toggle Breakpoint.Ĭontinue execution by selecting Debug > Run/Continue. For example, click the Playnite menu button to break in GetMainMenuItems. To trigger the debugger to break, interact with the extension somehow. A tab named " LibraryExporter.psm1 " will appear in PowerShell ISE. The debugger will automatically break when code is executed. Use the commands Get-Runspace or (Get-Runspace).Name to list runspaces.ĭebug the script by attaching to the runspace: Debug-Runspace -Name "LibraryExporter.psm1" Identify the correct runspace name of your script. Open the 64-bit bit version of PowerShell ISE.Įnter the PowerShell host process of Playnite: Enter-PSHostProcess -Name Playnite.DesktopApp Debugging Scripts Debugging PowerShell Scripts with PowerShell ISE
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |