Windows (10.0.19042) debugger (VS Code vsdbg and Visual Studio) can not attach to PowerShell (7.1.3)

%3CLINGO-SUB%20id%3D%22lingo-sub-2360606%22%20slang%3D%22en-US%22%3EWindows%20(10.0.19042)%20debugger%20(VS%20Code%20vsdbg%20and%20Visual%20Studio)%20can%20not%20attach%20to%20PowerShell%20(7.1.3)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2360606%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%3CBR%20%2F%3Ethank%20you%20for%20the%20new%20cross-platform%20PowerShell.%20Really%20an%20improvement%20and%20fun%20to%20use.%20However%20I%20cannot%20get%20Windows%20debuggers%20to%20attach%20to%20one%20at%20the%20moment.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EAttaching%20Visual%20Studio%20to%20older%20Windows%20PowerShell%205.1.19041.906%20succeeds%20but%20trying%20to%20attach%20to%207.1.3%20results%20in%20%22Unable%20to%20attach%20to%20the%20process.%20A%20debug%20component%20is%20not%20installed.%22.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EVisual%20Studio%20version%20is%26nbsp%3BVisualStudio.16.Release%2F16.9.5%2B31229.75%20Community.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EWhen%20selecting%20a%20process%20to%20attach%20to%2C%20Visual%20Studio%20does%20recognizes%20pwsh.exe%20as%20%22Automatic%3A%20Managed%20(.Net%20Core%2C%20.Net%205%2B)%20code%22%20in%20the%20Attach%20to%3A%20-field.%20But%20then%20it%20just%20cannot%20attach%20to%20it.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EVisual%20Studio%20Code%20debugger%20vsdbg%20reports%20%22Unable%20to%20attach%20to%20CoreCLR.%20Unknown%20Error%3A%200x80131c3c%22.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EVS%20Code%20version%20is%201.56.2%20(user%20setup).%3C%2FP%3E%3CP%3E%3CBR%20%2F%3Evsdbg%20is%20Microsoft%20.NET%20Core%20Debugger%20(vsdbg)%2C%20no%20version%20information%20available%2C%20at%20%24HOME%5C.vscode%5Cextensions%5Cms-dotnettools.csharp-1.23.11%5C.debugger%5Cvsdbg.exe.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3Evsdbg%20is%20launched%20with%20command%20line%20parameters%26nbsp%3B'--interpreter%3Dvscode'%20and%20'--connection%3D%3CA%2032%3D%22%22%20character%3D%22%22%20string%3D%22%22%20target%3D%22_blank%22%3E'.%3C%2FA%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EThe%20Visual%20Studio%20Code%20error%20code%200x80131c3c%26nbsp%3Bseems%20to%20be%20related%20to%20PowerShell%20on%20non-Windows%20platforms.%20Googling%20%22debug%20component%20is%20not%20installed%22%20for%26nbsp%3Bvisual%20studio%20and%20.net5%20gives%20an%20article%20that%20has%20both%20error%20messages%20mentioned%3A%26nbsp%3B%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fdotnet%2Fcore%2Fdeploying%2Fsingle-file%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fdotnet%2Fcore%2Fdeploying%2Fsingle-file%3C%2FA%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EAccording%20to%20that%20article%2C%20these%20error%20messages%20are%20given%20when%20mscordbi.dll%20is%20not%20in%20the%20same%20folder%20as%20the%20executable.%20In%20my%20case%2C%20the%20dll%20(MS%20.NET%20Runtime%20Debugging%20Services%2C%205.0.421.11614)%20is%20in%20the%20same%20folder%20as%20pwsh.exe.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EAnyone%20have%20any%20idea%20about%20the%20PowerShell%20debug%20component%20that%20VS%20would%20like%20to%20have%20installed%20or%20why%20Code%20gives%20that%20%22Unable%20to%20attach%20to%20CoreCLR.%20Unknown%20Error%3A%200x80131c3c%22%3F%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EBR%20and%20many%20thanks%20in%20advance%2C%3C%2FP%3E%3CP%3EDH%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2360606%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3E.Net%20Core%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EVisual%20Studio%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Regular Visitor

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

 

0 Replies