mono : Is remote debugging possible with monodevelop?
This could actually be done with the Soft Debugger.
Is MonoDevelop remote debugging works on Windows
Prooved! It works. The problem was in unhandled exception thrown by VirtualMachineManager.ListenInternal(2) method in Mono.Debugger.Soft. More details here - Can't use Mono Soft Debugger Remote Debugging because 'debugger-agent: DWP handshake failed' error
Debugging mono applications directly on ARM target
Monodevelop can debug remote targets if you have networking going. before launching monodevelop you need to set the environment variable:
MONODEVELOP_SDB_TEST=1
Then when you launch MD you'll have "Custom Mono Soft Debugger" as a "Debug With" option.
On the remote host, launch your debug target like so (I'm assuming it has a shell):
mono --debug \
--debugger-agent=transport=dt_socket,address=0.0.0.0:12345,server=y \
myprogram.exe
In Mono develop, set your breakpoints and then input the IP address of your target machine and the port number above and click Connect. That should break into the debugger remotely.
Linux .NET remote debugging from Visual Studio
I have finally found a good way to perform remote debugging of C# code running on my Raspberry Pi. I have switched from Mono to .NET Core and can now use Visual Studio to debug code running on the Raspberry Pi almost as easy as when running on my development machine.
The following steps were tested using Windows 10 version 1909, Visual Studio 2019 version 16.4.3, Raspbian Buster Lite version 2020-02-13 and a Raspberry Pi 2 Model B. .NET Core requires an ARMv7 CPU, so it will not run on Raspberry Pi 1 and Zero.
Go to https://dotnet.microsoft.com/download/dotnet-core and select .NET Core 3.1 (or later). Click the link for Linux ARM32 runtime binaries and copy the direct link displayed on the next page. (Do not right-click the ARM32 link and select copy link address, as you will end up with a webpage if you download that link.)
Open a SSH session to the Raspberry Pi, download and install the binaries:
ssh pi@192.168.0.xxx
wget https://download.visualstudio.microsoft.com/download/pr/c11e9248-404f-4e5b-bd99-175079419d6f/83902a43e06f9fb4e45a4c6a6d5afc0b/dotnet-runtime-3.1.3-linux-arm.tar.gz
sudo mkdir /opt/dotnet
sudo tar zxf dotnet-runtime-3.1.3-linux-arm.tar.gz -C /opt/dotnet
sudo ln -s /opt/dotnet/dotnet /usr/bin/dotnetAdd the following line to
~/.bashrc
, logout and login again to activate:export DOTNET_ROOT=/opt/dotnet
Check that .NET Core has been installed correctly:
dotnet --info
Create a *.NET Core Console App```lang-none in Visual Studio. Set Target framework = .NET Core 3.1 (or the version you downloaded to the Raspberry Pi). Make sure that Project → Properties → Build → Output → Advanced → Debugging information = Portable.
Build the project in Visual Studio and copy all *.dll, *.pdb, *.deps.json and *.runtimeconfig.json files from the development machine to the Pi. PuTTY's pscp command can be used:
cd bin\Debug\netcoreapp3.1
pscp -pw <password> *.dll *.pdb *.deps.json *.runtimeconfig.json pi@192.168.0.xxx:/home/piOpen a SSH session to the Raspberry Pi and run the program, or start it from the development machine using SSH:
ssh pi@192.168.0.xxx dotnet /home/pi/MyProgram.dll
Attach to the remote process by selecting the Debug → Attach to Process menu item in Visual Studio. Select Connection type = SSH and in the Connection target textbox, type pi@192.168.0.xxx and press Enter.
Enter password and click the Connect button.
Click the Select button.
Select Managed (.NET Core for Unix) and click the OK button.
Select the
dotnet MyProgram.dll
process and click the Attach button. The first connection might take several minutes, but subsequent connections are much faster.
Enjoy setting breakpoints, adding watches, stepping through code and even using "Set Next Statement" - almost as fast as when debugging on the local machine. The only thing I'm missing so far is Edit and Continue, but not enough to investigate if it is possible to achieve.
Is it possible to remotely debug a Mono console app from Visual Studio?
It seems it is not possible with free software. I can use Visual Studio with MonoRemoteDebugger and if I have doubts about code compatibility, I can build the project in Xamarin which permits targeting Mono.
debugging dotnet core 2.0 project with monodevelop
Didn't expect that after a year it is me again to answer this question.
I just started an open source extension to hook Samsung's open source .NET Core debugger to MonoDevelop,
https://github.com/lextudio/monodevelop.netcoredbg
Related Topics
Getting a Request.Headers Value
Load Different CSS File Based on Browser
Error While Using Executenonquery C#
The Controls Collection Cannot Be Modified Because the Control Contains Code Blocks (I.E. <% ... %>)
Find If Lista Contains Any Elements Not in Listb
HTML5 Email Input Cannot Assign Id and Runat="Server" ASP.NET 4
Does Ef Upsert Have to Be Done Manually
Com Object That Has Been Separated from Its Underlying Rcw Cannot Be Used
Pinvokestackimbalance C# Call to Unmanaged C++ Function
Sharing Variables Between C# and C++
C# Linq Where Clause as a Variable
.Net Vs Java Garbage Collector
Difference Between SQLdatareader.Read and SQLdatareader.Nextresult