I run into the problem where VSCode prompts
Debug adapter process has terminated unexpectedly
For a C# project created using console template; when I debug it by pressing "F5" key.
I do not have any problems in compiling the project.
I have performed dotnet run on the project folder. I see the "Hello World" printed on the command prompt without any problem.
My version strings
VSCode : 1.14.2
dotnet : 2.0.0-preview2-25407-01
C# extn : 1.11.0
OS : Microsoft Windows NT 6.1.7601 Service Pack 1 (Windows 7 - 64 bit)
I do not have any info in event log.
How do I tackle this error?
[Update]
OmniSharp debug server is exiting/closing when they are launched suspiciously!
Where do I collect the log for the OmniSharp debug server?
I do not have anything printed on my Output window in VS Code. I do not even see OmniSharp log source in the Output filter dropdown.
[Additional information]
Noted same error when I run the application in non-debug mode as well using "Ctrl+F5" key.
Browsed VS Code's source code in github; the error message appears when debug server is not in disconnected state while exiting the server. Pursuing further on building a call graph, onServerExit are called
1. close event of the socket create in [connectServer] (https://github.com/Microsoft/vscode/blob/fbece01268f4e5d290a470b328eea6312069eda0/src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts#L433)
2. exit event of the debug server process launched in [startServer] (https://github.com/Microsoft/vscode/blob/fbece01268f4e5d290a470b328eea6312069eda0/src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts#L437)
Now my question gets refined to why is the debug server exiting / closing when they get created?
Could this be due to permissions or port numbers or something else? Where should I look for such problems in my machine?
Related
I am trying to follow this tutorial to run azure function app using C# using vscode.
But when I click the run button, it shows "You must have the Azure Functions Core Tools installed to debug your local functions." But I have actually installed it in my mac. When I click the install button, it shows errors like follows:
/bin/bash: func: command not foundThe terminal process "/bin/bash '-c', 'func host start'" failed to launch (exit code: 127).
And on the right bottom there is a small window showing:
Error exists after running preLaunchTask "host start". View task output for more information.
But when I use the command func host start in my local terminal, it can run smoothly.
We have tried the same but on Windows(OS) , Below are the workaround to resolve the above issue.
Created a new Azure function with HTTP Trigger using .net 6
Before debugging we have started the Azure storage Emulator/Azurite on local.
Or Alternatively, We can add "AzureWebJobsStorage": "UseDevelopmentStorage=true", in our localsettings.json and tried to debug by using .net Function.
OUTPUT DETAILS FOR REFERENCE:-
NOTE:- To run function locally based on the given MICROSOFT DOCUMENTATION:-
Click on Ctrl - (macOS) the HttpExample function and choose Execute
Function Now
Or, we can add a breakpoint over our function.cs file and type start debug as shown below :-
For more information regarding VS CODE on macos configuration Please refer this SO THREAD discussions .
I'm trying to debug a Linux container that runs a C#/.NET 6.0 console application from Visual Studio 2019 (version 16.11.10).
When I use Debug / Attach to Process... to connect to my running container and attach to my process, I get the error:
Failed to launch debug adapter. Additional information may be available in the output window.
Unable to find debugger script at '/home/dockeruser/.vs-debugger'
For company security purposes, I'm running my container workloads as user dockeruser, but I can reproduce this when I adjust my Dockerfile to run as user root. The error message changes into
Unable to find debugger script at '/root/.vs-debugger'
Output shows
Unable to find debugger script at '/home/dockeruser/.vs-debugger'.
Initialization log:
Determining user folder on remote system...
Checking for existing installation of debugging tools...
Downloading debugger launcher...
Creating debugger installation folder: /home/dockeruser/.vs-debugger
Copying debugger launcher to /home/dockeruser/.vs-debugger/GetVsDbg.sh
Failed: Failed to copy files.
Unable to find debugger script at '/home/dockeruser/.vs-debugger'.
Failed: Unable to find debugger script at '/home/dockeruser/.vs-debugger'.
The program '[1] dotnet' has exited with code -1 (0xffffffff).
I can work around this by docker exec'ing a bash session on my container and running GetDbgVs.sh as detailed in https://stackoverflow.com/a/68950674/17273131, but its a pain to do - it feels like something is misconfigured.
I've already verified that my windows identity is a member of the windows docker-users group.
While not the answer I wanted, I've got a 1-liner shell workaround that I execute on my container when I want to debug attach with VS2019, once I know my <CONTAINER_NAME>. This may be useful to others with this problem.
docker exec -u root <CONTAINER_NAME> sh -c "apt-get update && apt-get install wget -y"; docker exec <CONTAINER_NAME> sh -c "mkdir -p ~/.vs-debugger; wget https://aka.ms/getvsdbgsh -O ~/.vs-debugger/GetVsDbg.sh; chmod a+x ~/.vs-debugger/GetVsDbg.sh"
The first command installs wget as root
The second command downloads GetVsDbg.sh to ~/.vs-debugger
I'm attempting to run a .Net console application (in TeamCity) I wrote which will change a variables value in a batch script located in the check out directory.
Unfortunately I'm receiving an error while running the step.
Process exited with code -2146232576
Currently I'm using a Command Line build step with the following settings:
Runner Type: Command Line
Step Name: Update setVars.bat
Execute Step: If all previous steps finished successfully
Run: Executable with parameters
Command Executable: E:\Test\Release\ReplaceText.exe
Command Parameters:
"%system.teamcity.build.checkoutDir%\DeploymentScripts\setVars.bat"
"(?m)(SET RunDate\s?=\s?[A-Za-z]{4}-[A-Za-z]{5}-(\d+[.]?)+)"
"SET RunDate=Build-%build.number%" "%system.teamcity.build.checkoutDir%\DeploymentScripts\setVars.bat"
There are 4 parameters listed.
1) - Where to locate the batch script
2) - The Regex pattern
3) - The replacement text
4) - The output directory
I'm unable to use the built in file replacer as it reverts back its changes once the build is successful.
I've run the console application on its own and it works just fine. So I'm unsure as to why team city is unable to run the application. The error code tells me nothing.
Any help would be great appreciated.
OK, I found the issue.
When I created the Console application I used VS 2017 with a .Net version of 4.6.2. That version of .Net is not installed on the CI server.
I changed the Console application to target .Net 4.5. This fixed the issue.
I just got some feedback of some users of our application, they have got issues on windows XP with our application. This application works fine on Windows 7, but not on Windows XP.
One other strange thing: If I build this on a Windows XP workstation(with VS2010), it works on my local workstations, and if I put this build on another XP workstation, it doesn't work anymore.
When running on XP, I just got an error telling me that XXXXX has encountered a problem and needs to close. We are sorry for the inconvenience.
I found in the EventViewer Application's log this stacktrace:
Application: MyApplication.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
at System.Windows.Forms.UnsafeNativeMethods+IOleObject.DoVerb(Int32, IntPtr, IOleClientSite, Int32, IntPtr, COMRECT)
at System.Windows.Forms.WebBrowserBase.DoVerb(Int32)
at System.Windows.Forms.WebBrowserBase.TransitionFromRunningToInPlaceActive()
at System.Windows.Forms.WebBrowserBase.TransitionUpTo(AXState)
at System.Windows.Forms.WebBrowserBase.OnParentChanged(System.EventArgs)
at System.Windows.Forms.Control.AssignParent(System.Windows.Forms.Control)
at System.Windows.Forms.Control+ControlCollection.Add(System.Windows.Forms.Control)
at My.NameSpace.Here.Controls.LearningCenterControl.InitializeComponent()
at My.NameSpace.Here.Controls.LearningCenterControl..ctor()
at My.NameSpace.Here.MainForm.InitializeComponent()
at My.NameSpace.Here.MainForm..ctor()
at My.NameSpace.Here.MainForm.get_Instance()
at My.NameSpace.Here.Program.Main(System.String[])
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
This happens on the InitializeComponent of the designer of one of my userControl:
this.m_learingResourceBrowser = new System.Windows.Forms.WebBrowser();
I guess there a Security issue with XP, but what?
I found this:
REM Mark project as DEP Noncompliant
call "$(DevEnvDir)..\..\VC\bin\vcvars32.bat"
call "$(DevEnvDir)..\..\VC\bin\editbin.exe" /NXCOMPAT:NO "$(TargetPath)"
I've put this Post-build event on the exe project, but I didn't saw any improvement
I've also tried to run directly the command with my exe:
editbin.exe /NXCOMPAT:NO YourProgram.exe
Any idea about what could cause this issue?
EDIT
I found this answer which states:
To test if its a DEP issue do this.
Right click on "My Computer" Select "Properties" and "Advanced" Under
"Startup and Recovery, click Settings Now click on "Edit" The notepad
has just begun. Simply replace the line: Code: noexecute optionn by
AlwaysOff Restart your PC to complete the transaction.
And I after this I don't have this error anymore. So my question is: currently I've done the previous operation only on the main exe. Should I do this operation on all dll? Because my project is composed of more than 230 projects, so it would be hard to test everything.
I'm using mono-2.6.7 and monodevelop-2.4, my OS is Windows 7.
I'm trying to implement a remote debugger for my own runtime (based on mono, mono is embedded in it, used lang - C#) in a way it's done by Novell for Moonlight.
Unfortunately, no success...
After clicking "Debug" in MonoDevelop:
IDE is put into debug state,
my runtime starts,
successfully sends DWP-Handshake to listening IDE
and then connection terminates and Debugging ends.
For some reasons (absolutely not clear for me) IDE doesn't send a handshake after recieving it from my runtime but simply terminates a connection.
The code i use is in another question: Can't use Mono Soft Debugger Remote Debugging because 'debugger-agent: DWP handshake failed' error
Does smb know if it can be done the save way it's done for Moonlight? Or it's it's impossible? Maybe there is another solution?
Prooved! It works. The problem was in unhandled exception thrown by VirtualMachineManager.ListenInternal(2) method in Mono.Debugger.Soft. More details here - Can't use Mono Soft Debugger Remote Debugging because 'debugger-agent: DWP handshake failed' error