microsoft / vscode-mono-debug

A simple VS Code debug adapter for mono
Other
159 stars 173 forks source link

Unable to debug with v0.16.0 #68

Closed hol430 closed 3 years ago

hol430 commented 3 years ago

Hi all, just a heads up that after upgrading to v0.16.0 of this extension, I'm unable to debug my C#/mono application. Downgrading to v0.15.8 fixes the problem. Here is my launch.json:

``` { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Launch", "type": "mono", "request": "launch", "program": "${workspaceRoot}/Bin/Progra.exe", "cwd": "${workspaceRoot}" }, { "name": "Attach", "type": "mono", "request": "attach", "address": "localhost", "port": 55555 } ] } ```

I'm not sure if there's a log somewhere which I can upload - let me know if there's any extra info I can give. From my perspective, I normally see something in the debug console like this when I start debugging: mono --debug --debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:46391 Bin/Program.exe. When using v0.16.0, however I just see mono Bin/Program.exe, and the program appears to be launched without the debugger attached. The program also doesn't seem to run correctly - I haven't tested extensively but I get some errors along the lines of debugger-agent: Unable to listen on 3 when attempting to compile scripts via System.CodeDom.Compiler.CompileAssemblyFromFile(). I don't get these errors when running normally (e.g. without vscode or vscode-mono-debug).

Apologies if I'm misusing the extension somehow - and let me know if I can provide any other diagnostics.

akoeplinger commented 3 years ago

Hm this sounds like it might have been caused by https://github.com/microsoft/vscode-mono-debug/commit/0f7bfa89e66e012dc287cae4656609ac2599b7fa.

I get some errors along the lines of debugger-agent: Unable to listen on 3 when attempting to compile scripts via System.CodeDom.Compiler.CompileAssemblyFromFile()

I can see how that might happen, if I remember correctly CompileAssemblyFromFile just starts the C# compiler via Process.Start internally. If that gets the MONO_ENV_OPTIONS from the parent process then it'd wait for a debugger connection.

I'll probably need to revert that commit and put it behind an option.

akoeplinger commented 3 years ago

Should be fixed now in v0.16.2, thanks for the report!

hol430 commented 3 years ago

Wonderful, thanks for the fast turnaround on that one. I did notice that on 0.16.2, the break on exception feature seems to be no longer working (it works for me on 0.15.8). Entirely possible that I've done something wrong, just thought I'd check if it's related to the above issue.

In case it helps, here is my configuration. I haven't touched it recently, so it would have been the same when testing against the two different versions of the extension.

"mono-debug.exceptionOptions": {
  "System.Exception": "always",
  "System.SystemException": "always",
  "System.ArithmeticException": "always",
  "System.ArrayTypeMismatchException": "always",
  "System.DivideByZeroException": "always",
  "System.IndexOutOfRangeException": "always",
  "System.InvalidCastException": "always",
  "System.NullReferenceException": "always",
  "System.OutOfMemoryException": "always",
  "System.OverflowException": "always",
  "System.StackOverflowException": "always",
  "System.TypeInitializationException": "always",
  "System.AccessViolationException": "always",
  "System.Configuration.ConfigurationErrorsException": "never",
  "System.IO.FileNotFoundException": "never"
}
GoaLitiuM commented 3 years ago

I'm having the same issue with 0.16.2, VSCode does not detect hit breakpoints, but debugged application pauses upon hitting that breakpoint and does not respond unless I stop debugging. 0.16.0 Shows an error error while processing request 'stackTrace' (exception: Index was outside the bounds of the array.) when beakpoint is hit. 0.15.8 is the latest vesion that seems to be working just fine.