Search code examples
c#macosmonoowinxamarin-studio

Debugging in Xamarin Studio for Nancy app which hosted with Owinhost


I am developing app with owin as my web host. I have successfully run my webapp by executing ../packages/OwinHost.3.0.1/tools/OwinHost.exe from my nancy app folder.

The question that I have is how can I perform debugging on my code? Is this possible at all?

My dev environment:

  • Mac OSX Yosemite
  • Xamarin Studio 5.9.4 (build 5)
  • Mono 4.0.2
  • Nancy 1.2.0
  • OwinHost 3.0.1

Solution

  • You can configure Xamarin Studio to run the OwinHost.exe directly then your breakpoints will be hit when debugging.

    1. Open the project options.
    2. Select Run - Custom Commands.
    3. In the drop down select Execute.
    4. The command text box should have the path to OwinHost.exe. You can browse to that file using the Browse button.
    5. Configure the Working directory. You will want to put the working directory to the directory underneath the bin directory. My bin directory which contained all the various dlls was inside the project's directory so I used ${ProjectDir}.
    6. Then you can click the arrow in the status bar or use Run - Start Debugging which will run the currently configured startup project.