Forum Discussion
Windows (10.0.19042) debugger (VS Code vsdbg and Visual Studio) can not attach to PowerShell (7.1.3)
Hello,
thank you for the new cross-platform PowerShell. Really an improvement and fun to use. However I cannot get Windows debuggers to attach to one at the moment.
Attaching Visual Studio to older Windows PowerShell 5.1.19041.906 succeeds but trying to attach to 7.1.3 results in "Unable to attach to the process. A debug component is not installed.".
Visual Studio version is VisualStudio.16.Release/16.9.5+31229.75 Community.
When selecting a process to attach to, Visual Studio does recognizes pwsh.exe as "Automatic: Managed (.Net Core, .Net 5+) code" in the Attach to: -field. But then it just cannot attach to it.
Visual Studio Code debugger vsdbg reports "Unable to attach to CoreCLR. Unknown Error: 0x80131c3c".
VS Code version is 1.56.2 (user setup).
vsdbg is Microsoft .NET Core Debugger (vsdbg), no version information available, at $HOME\.vscode\extensions\ms-dotnettools.csharp-1.23.11\.debugger\vsdbg.exe.
vsdbg is launched with command line parameters '--interpreter=vscode' and '--connection=<a 32 character string, looks like a hash>'.
The Visual Studio Code error code 0x80131c3c seems to be related to PowerShell on non-Windows platforms. Googling "debug component is not installed" for visual studio and .net5 gives an article that has both error messages mentioned: https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file
According to that article, these error messages are given when mscordbi.dll is not in the same folder as the executable. In my case, the dll (MS .NET Runtime Debugging Services, 5.0.421.11614) is in the same folder as pwsh.exe.
Anyone have any idea about the PowerShell debug component that VS would like to have installed or why Code gives that "Unable to attach to CoreCLR. Unknown Error: 0x80131c3c"?
BR and many thanks in advance,
DH
- Jason Thompson (ID CXP)MicrosoftI had this same issue. I realized I had installed PowerShell 7 via the Microsoft Store so I uninstalled that and reinstalled the MSI version. That resolved the issue for me.