Does Xamarin Studio allow debugging a library (dll) project in an easier way than this?

864 views Asked by At

I'm developing a C# dll, called child.dll, which will be loaded by another 3rd-party C# executable program, called parent.exe. I don't have an access to the source code of parent.exe.

On Visual Studio, when I want to debug my dll project, I just have to attach the debugger to parent.exe and that's it. I can't find an easy way to do this on Xamarin Studio.

What I'm doing now are:

  1. Set env var MONODEVELOP_SDB_TEST=1 to enable "Custom Command Mono Soft Debugger"
  2. Launch Xamarin Studio using the same terminal as the first step.
  3. Uncheck "Debug project code only; do not step into framework code" in Xamarin Studio Options -> Debugger
  4. Add a dummy exe project in the same solution of my child.dll. This is because Xamarin Studio doesn't allow "Run with" for the library project type. By doing this, I can now access "Run with" feature of the Xamarin Studio.
  5. Build the whole solution, copy child.dll to where parent.exe want it to be and run mono --debug --debugger-agent=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:55555 parent.exe parent-args. (Parent.exe will load child.dll)
  6. Set the dummy project as a startup roject
  7. Run with > Custom Command Mono Soft Debugger and connect to 127.0.0.1:55555

I'm finding a way to let other developers in my company be able to create and debug their own child.dll under parent.exe. I think the only unacceptable step is the fourth step which doesn't make any sense for them.

Does anyone face the same issue as mine? How did you achieve your goal?

Update Info

I've over-simplified the question. In the real scenario, I didn't manage parent.exe myself. parent.exe has already been running (with this exact command mono --debug --debugger-agent=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:55555 parent.exe parent-args), it was started (Process.Start) by another program as a part of the whole framework.

Basically, the workflow for developers who create child.dll is to create a dll that defines some APIs the framework needs. Then, inject the dll to the framework.

1

There are 1 answers

2
Lluis Sanchez On BEST ANSWER

Right click on the library project, then on Project Options -> Run -> Custom Commands. In the combo, select Execute and enter the path to parent.exe. Now you'll be able to "run" the library, and the debugger will stop on breakpoints you put in the library code.