> On 22 Nov 2017, at 09:13, R Zaghi <rza...@mosaic3dx.com> wrote:
> 
> Hi everybody
> 
> I was wondering how to debug C# code when I am using the Mono Embedded API in 
> my application (using MSVS and MonoDevelop, whichever is used).
> 
> I have found this page on the net which seems to cover a lot but is also old:
> http://www.jeffongames.com/2012/03/debugging-embedded-mono/
> 
> Would you suggest any other pages to look at? Is the information on that page 
> still valid?
> 
Here are my notes on using the soft debugger - I regularly debug code running 
on macOs debugee with the debugger on a windows 10 VM.

HTH

Jonathan

Mono soft debugger
==================

https://eladnava.com/debug-remote-mono-apps-via-xamarin-studio/

The embedded managed code can be debugged (including breakpoints and single 
stepping) using Xamarin Studio.

Note that to be able to debug an assembly the corresponding .mdb file must be 
present.
If this is not the case then breakpoints are not respected.

Managed app acts as a client that connects to the Xamarin studio hosted debug 
server.
In the example below the Windows 10 VM has a configured IP address of 
192.168.1.72.
If using Fusion ensure that the Network Adapter preference is set to Autodetect 
: then set the Windows client IP address as above.

1. MAC : Soft debugger client 
2. MAC : call +setRuntimeOptions: with IP address and port of Windows VM 
running the Xamarin Studio debugger.
3. MAC : Run app outside of Xcode. The app will pause if the remote debugger is 
not responding.
4. PC : Ensure that MONODEVELOP_SDB_TEST env variable is set to 1 for the 
current user. Right mouse Computer - Advanced System Settings.
5. PC : Run Xamarin Studio (preconfigure env var as above to enable the soft 
debug menu) on the VM and load the target solution. 

7. PC : on Xamarin 5 - Select Run - Run with - Custom commnad Mono soft 
debugger.
8. PC : on Xamarin 6 - Select Run - Run with - Custom Configuration - Run 
Action - Debug - CustomCommand Mono SoftDebugger - Debug.
9. PC : Enter IP address and port.

8. PC : Click Listen. The debugger needs to know what specific IP to listen on 
as it may have multiple IP addresses.
9. PC : Set breakpoints as normal.
10. MAC : Exercise app to trigger break point after which the managed code can 
be stepped through.

Notes on Use of the Mono Soft Debugger
======================================

See http://www.jeffongames.com/2012/03/debugging-embedded-mono/
http://mono.1490590.n4.nabble.com/remote-debugging-a-hello-world-application-td4591791.html

The debugee should connect to the debugger on the configured listener IP and 
port.
The Windows firewall will need to allow the incoming connection : it should pop 
up a confirmation alert.

To check if the connection is up and running use telnet:

// manual check if connection to debugger listener on Windows VM can be 
established
telnet 192.168.1.72 10000

// check state of established network connections 
netstat -n -f inet

For the soft debugger signal handler to work correctly the app must be executed 
without lldb attached.
This can be achieved in two ways:

1. Run app under the Xcode Test (ie: no debugger attached) scheme.
2. Run binary outside of Xcode.

Other signal handlers, such as those installed by HockeyApp, must be disabled 
while the soft debugger is in use.
Remember to use a debug build of the managed code!

http://www.mono-project.com/docs/advanced/runtime/docs/soft-debugger/

> Thanks
> Ramin
> 
> 
> -- 
> 
> 
> 
> Ramin Zaghi
> 
> Mosaic3DX™ | User Interface Technology
> St John's Innovation Centre,
> Cowley Road,
> Cambridge,
> CB4 0WS, UK
> E: rza...@mosaic3dx.com
> T: +44 1223 421 311
> http://linkedin.com/in/raminzaghi
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list@lists.dot.net
> http://lists.dot.net/mailman/listinfo/mono-devel-list

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.dot.net
http://lists.dot.net/mailman/listinfo/mono-devel-list

Reply via email to