Can the Mono compiler as a service be used in a debugging context?

410 Views Asked by At

I'd like to know if and how I might be able to use the Mono compiler as a service (see here and here ) within a debugging context to query/modify/visualize/etc objects at runtime within the debugger. At the moment, per this SO post the Roslyn CTP does not support this feature.

2

There are 2 best solutions below

2
On BEST ANSWER

Yes, thats perfectly possible. I cannot tell you the exact details on how to implement this, but take a look at MonoDevelop which actually implements your idea since v2.8 (or maybe earlier). In MonoDevelop, you have a REPL Pad available, which allows you to enter C# code in the very same context your application stopped because of a breakpoint. I've attached a simple Screenshot of MD in the debugging view and the REPL pad open. Since MD is opensource, you could check out the sources how it was implemented and strip the parts that you need.

Screenshot of MonoDevelop using Direct/REPL evaluation window while debugging

0
On

I think it should be feasible because Mono Soft Debugger is part of the Mono runtime so you could use the "Debugger Agent":

The debugger agent is a module inside the mono runtime which offers debugging services to client programs.

So, one alternative could be trying to interface with the Mono Soft Debugger in your compiler as service (which runs on top of the Mono runtime).

As the Mono Soft Debugger is used in the MonoDevelop IDE you could also investigate if this IDE could be used for what you are looking for.