oleg-shilo / cs-script.vscode

VSCode extension for CS-Script
MIT License
37 stars 7 forks source link

Debugging does not work #17

Closed KG2501 closed 3 years ago

KG2501 commented 4 years ago

I installed on Windows 10 Enterprise. I installed the latest version of VS Code (1.41.1). I installed CS-Script (v3.29.0) via chocolaty. I installed Mono 6.8 I installed latest extension versions of "ms-vscode.mono-debug" (v0.15.8) and "ms-vscode.csharp" (v1.21.9) and "oleg-shilo.cs-script" (v1.5.10). No I wrote a very simple script (see attachment, extension has to be renamed to *.cs) Test.txt

And tried to debug with Alt+F5. the Debug console shows: mono --debug --debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:33949 cscs.exe -d -inmem:0 -co:/debug:pdbonly -ac:2 c:\Temp\TestScripts\Test.cs

And after a few seconds (I translated it from german to english): The command ""c:\Temp\TestScripts\mono.exe"" is either misspelled or could not be found.

My path environment variable is pointing to the right directories: PATH=C:\Program Files\Mono\bin;C:\ProgramData\chocolatey\lib\cs-script\tools\cs-script\lib;C:\ProgramData\chocolatey\lib\cs-script\tools\cs-script

What is wrong?

oleg-shilo commented 4 years ago

It looks like mono is not interpreted as a dedicated debugger but as a generic executable. It is still kind of OK but apparently in your case VSCode cannot find mono.

Looking at PATH it is exactly what I would be doing. But it seems OK. And I assume you have restarted VSCode after installing mono.

You can also check if you can simply start mono in command prompt.


As a quick tip:

image

If this does not help then we may consider specifying mono with an absolute path.

KG2501 commented 4 years ago

Thanks for the quick reply, but unfortunately it still doesn't work. I rebooted my complete PC in the meantime and followed your instructions to create a new test script, but with the same error. What I noticed this time is, that there is a double backslash before mono.exe: ""c:\Temp\TestScripts\mono.exe"" Where does this come from? You mentioned to specify mono with an absolute path. Where can I configure this?

oleg-shilo commented 4 years ago

Sorry, I cannot answer this question. Debugging on .NET/Mono in VSCode is fully controlled by MonoDebug extension. CS-Script simply "asks" this extension to load cs-script engine (cscs.exe) for debugging:

mono --debug --debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:33949 cscs.exe...

And it is MonoDebug who is launching mono.exe. It does it by default with the mono as the name of the executable without the path. Normally it is enough but for some reason in your case mono cannot be resolved so it assumes you want to run it from the current dir c:temp\testscripts.

CS-Script extension is not aware about mono so it cannot help in this situation. Thus it is ModoDebug who controls starting mono.

I assume that somewhere in MonoDebug there is a way to specify mono executable with an absolute path. But it is only an assumption and I am not sure how to do that.

My quick check with VSCode.MonoDebug reveled nothing specific :(

BTW this sort of mono problems made me to start migrating the extension on .NET Core.