question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Debugging in Mono scripting

See original GitHub issue

I wanted to start a recorded discussion here of what it might take to support debugging when running under Mono via mono’s remote debugger. The main use case I am interested in is being able to debug through VS-Code’s Mono Debugger extension.

So far I think I have the pieces to make this happen from VS-Code, but we’re obviously still missing support in Cake’s implementation that uses the mono script host.

Here’s the piece for VS-Code that I think should mostly make it work once Cake supports it:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "StartCake",
            "type": "mono",
            "request": "launch",
            "program": "${workspaceRoot}/tools/Cake/Cake.exe",
            "runtimeArgs": [
                "--debug",
                "--debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:55556"
            ],
            "args": [
                "${workspaceRoot}/build.cake",
                "--verbosity=diagnostic",
                "--debug"
            ],
            "cwd": "${workspaceRoot}",
            "console":"internalConsole",
            "noDebug": true
        },
       {
            "name": "AttachCake",
            "type": "mono",
            "request": "attach",
            "address": "localhost",
            "port": 55556
        }
    ],
     "compounds": [
        {
            "name": "DebugCake",
            "configurations": ["StartCake", "AttachCake"]
        }
    ]
}

As for the Cake changes, I think first of all we need to take a look somewhere in here: https://github.com/cake-build/cake/blob/develop/src/Cake/Scripting/Mono/MonoScriptSession.cs#L54

Basically, this SO answer shows how to enable generating debug symbols in mono’s script host: http://stackoverflow.com/questions/875723/how-to-debug-break-in-codedom-compiled-code

What I’m not exactly clear on is how do we go from having debug symbols generated for the generated script, to resolving breakpoints from the original script before it was transformed…

@mholo65 any ideas? I see you implemented the original debugging on the Roslyn side…

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
Redthcommented, Apr 2, 2017

Yeah. I’ll open one in the vs-code repo to track getting mono debugging working there.

0reactions
patriksvenssoncommented, Apr 2, 2017

@Redth Can we close this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debugging
This is achieved using the -debug command line option of the C# compiler. In Mono 1.0.x this embeds the debugging information in the...
Read more >
The Mono Debugger | Enterprise Architect User Guide
When you launch Mono you need to direct it to support debugging. This is achieved through a command line directive in which you...
Read more >
Debugging C# assembly launched by embedded mono ...
Using MonoDevelop to accept debugger connections from embedding hosts currently requires creating an addin, but this is fairly straightforward.
Read more >
Manual: Debug C# code in Unity
You can use a debugger to inspect your source code while your application is running. Unity supports the following code editors to debug...
Read more >
About IL2CPP Managed Debugger
For many Unity versions, it has been possible to debug C# script code with Visual Studio when the Mono scripting backend is used....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found