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

时间:2015-06-26 09:46:19

标签: debugging xamarin monodevelop xamarin-studio soft-debugger

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 个答案:

答案 0 :(得分:4)

右键单击库项目,然后单击项目选项 - >运行 - >自定义命令。在组合中,选择“执行”并输入parent.exe的路径。现在,您将能够“运行”库,并且调试器将在您放入库代码中的断点处停止。