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:
- Set env var
MONODEVELOP_SDB_TEST=1
to enable "Custom Command Mono Soft Debugger" - Launch Xamarin Studio using the same terminal as the first step.
- Uncheck "Debug project code only; do not step into framework code" in Xamarin Studio Options -> Debugger
- 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. - Build the whole solution, copy
child.dll
to whereparent.exe
want it to be and runmono --debug --debugger-agent=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:55555 parent.exe parent-args
. (Parent.exe
will loadchild.dll
) - Set the dummy project as a startup roject
- 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.
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.