Execute Selection Menu Option Output Issue
After selecting a section of script and choosing Execute Selection from the right-click menu options, the entire VS interface briefly turns orange, displays a couple of windows (too quickly to note which ones), but does nothing else. No output is displayed.
I’m currently evaluating PowerShell Tools for possible purchase.
Visual Studio Version
Microsoft Visual Studio Community 2019
Version 16.2.5
VisualStudio.16.Release/16.2.5+29306.81
PoshTools Version
PowerShell Pro Tools for Visual Studio 1.0
A set of tools for developing and debugging PowerShell scripts and modules in Visual Studio.
$PSVersionTable Output
Name Value
PSVersion 5.1.18985.1
PSEdition Desktop
Comments (16)
-
-
reporter I had to install VS2019 and PowerShell Tools on the server on which the script is deployed (development workstation doesn’t have access to the database the script targets).
Version Information for New Installation
PSVersionTable
Name Value ---- ----- PSVersion 5.1.14393.3053 PSEdition Desktop
Visual Studio
Visual Studio Community 2019
Version 16.3.0
When repro-ing the issue after installation, the VS interface turns orange and I see the following error
This is a fresh install of both VS2019 and the PowerShell Tools extension.
Here’s the code section I’m running (certain variable values have been obsfucated)
Function Create-DBConnection(){ # Begin Oracle Setup Code. DO NOT CHANGE THE FOLLOWING CODE switch (Test-Path ($env:ORACLE_HOME = "C:\oracle\product\12.2.0\client_1")) {$false {Write-Host "Oracle database client is not installed. INVSRV will not be updated."} } $env:PATH = $env:ORACLE_HOME+ "\ODP.NET\managed\common\" + $env:PATH #Load Provider $file=$env:ORACLE_HOME+ "\ODP.NET\managed\common\" + "Oracle.ManagedDataAccess.dll" [Reflection.Assembly]::LoadFrom($file) # End Oracle Setup Code. $usrid = "username" $crd = Import-Clixml C:\path\to\file.xml $nc = $crd.GetNetworkCredential() $datasrc = "hostname:port/DATABASE" # Initiate connection to database $script:connection = New-Object Oracle.ManagedDataAccess.Client.OracleConnection('User Id='+$usrid+';Password='+$nc.Password+';Data Source='+$datasrc+';connection timeout=30') return $connection }
I can open the interactive window, but after the error pop-up the Execute Selection menu option is gone until debugging is force stopped. Re-running Execute Selection with the Powershell Interactive window, after force stopping debugging, results in the same pop-up error as before; the powershell interactive window is auto-closed when the error appears.
I’ve tried running VS2019 with elevated privileges as well, with the same results.
Note: The version info
Will try re-installing and re-repro-ing the issue.
-
Interesting. The extension should be checking to make sure you have the correct dependencies install but from the looks of it, you don’t have the Desktop Development workload installed. In the VS installer, try installing that workload.
-
reporter The .NET desktop development workload is installed, do I need to install the Desktop development with C++ workload?
-
reporter Following up to find out if the Desktop Development with C++ Workload is needed or if the .NET Development Workload is sufficient
-
You don’t need the C++ development workload. You should just need the .NET Development Workload. Can you please open the Help->About Visual Studio and click the Copy Info button there and paste that here so I can review?
-
reporter Here’s the output
Microsoft Visual Studio Community 2019
Version 16.3.0
VisualStudio.16.Release/16.3.0+29318.209
Microsoft .NET Framework
Version 4.8.03761Installed Version: Community
Azure App Service Tools v3.0.0 16.3.282.33872
Azure App Service Tools v3.0.0C# Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed InfoMicrosoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual MachinesMicrosoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggersNuGet Package Manager 5.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/PowerShell Pro Tools for Visual Studio 1.0
A set of tools for developing and debugging PowerShell scripts and modules in Visual Studio.ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed InfoVisual Basic Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.Visual F# Tools 10.4 for F# 4.6 16.3.0-beta.19455.1+0422ff293bb2cc722fe5021b85ef50378a9af823
Microsoft Visual F# Tools 10.4 for F# 4.6Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio -
That looks fine to me. Can you compare this to the other machine you were trying?
-
reporter The other machine also has the .NET desktop workload installed. Here’s the output:
Microsoft Visual Studio Community 2019
Version 16.3.1
VisualStudio.16.Release/16.3.1+29324.140
Microsoft .NET Framework
Version 4.8.03921Installed Version: Community
ASP.NET and Web Tools 2019 16.3.283.64955
ASP.NET and Web Tools 2019Azure App Service Tools v3.0.0 16.3.283.64955
Azure App Service Tools v3.0.0C# Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed InfoNuGet Package Manager 5.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/PowerShell Pro Tools for Visual Studio 1.0
A set of tools for developing and debugging PowerShell scripts and modules in Visual Studio.ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed InfoTypeScript Tools 16.0.10821.2002
TypeScript Tools for Microsoft Visual StudioVisual Basic Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio -
reporter Is there any other information you need?
-
Not at the moment. You could try to upgrade the VS instance for the one that isn’t work but I don’t think that will help.
Do you have any time this week for us to look at this together? I’d be happy to hop on a screen share.
-
reporter Would this Friday work for you? If it would, I should be available between 8:30 and 3:30 PM CST
-
reporter Following up on the screen share offer; do you have time today?
-
Yep. Can you email me at adam[at]poshtools.com?
-
reporter I uninstalled and re-installed VS and the Powershell Tools extension this morning, making sure to put the server in INSTALL mode beforehand.
Unfortunately, while running the test script via the Start Debugger button worked, I see the same problem when selecting the Execute Selection menu option for the script in the project.
I’m not sure if this helps, but I did notice that the trial warning appeared after the re-install, before I installed the PoSH extension; looks like some settings are retained post-uninstall.
-
- changed status to resolved
Resolved in v5.1.1
- Log in to comment
Can you show the snippet you are trying to run? Can you open the PowerShell Interactive Window (View->Other Windows->PowerShell Interactive Window) and see if there is any output there?