How can you debug into a library project contained in another solution?

ChrisMillerChrisMiller USBeta, Developer Group Leader ✭✭

I want to debug into Monotouch code compiled as a library in another solution. Can that be done with Xamarin Studio running on OS X? I can load both solutions in and set breakpoints in the library, but those breakpoints are never reached.

Posts

  • mhutchmhutch USXamarin Team Xamurai

    Yes, in debugger settings disable "Debug project code only".

  • ChrisMillerChrisMiller USBeta, Developer Group Leader ✭✭

    Thanks!

  • mhutchmhutch USXamarin Team Xamurai

    On re-reading your post this does sound like a bug - breakpoints should still be hit. This setting is only supposed to affect stepping. Could you please file a bug?

  • ChrisMillerChrisMiller USBeta, Developer Group Leader ✭✭
  • mhutchmhutch USXamarin Team Xamurai

    I think the problem is triggered by the fact that you have multiple solutions open. AFAIK all breakpoints are "owned" by the solution that "owns" the file into which you put the breakpoint - and function breakpoints and breakpoints in files opened independently of a solution (i.e. File->Open) are owned by the "active" solution when you create the breakpoint. And the debugger only tries to insert breakpoints owned by the solution being debugged.

    As a workaround, you could just open one solution, but open the files from the other solution directly (File->Open) independently of that other solution.

  • LluisSanchezLluisSanchez ESXamarin Team Xamurai

    @mhutch: I don't think that's the case, unless something has changed recently. Breakpoints don't depend on projects. They are specified using a file name and a line/column. It doesn't matter were the file comes from. Maybe the problem is that the mdb of the external library is not being deployed?

  • mhutchmhutch USXamarin Team Xamurai
    edited March 2013

    @lluis: That might be a problem too then - if breakpoints don't belong to a solution then there will almost certainly be problems with cross-solution pollution and clearing of of breakpoints when loading/saving userprefs.

  • LluisSanchezLluisSanchez ESXamarin Team Xamurai

    @mhutch: yes, it happens, although that's a more general problem about userprefs. When you have two solutions open, there is now easy way to know which settings are relevant to which solutions.

  • mhutchmhutch USXamarin Team Xamurai

    So in this case it might be that the breakpoints from the first solution are being cleared when the second is loaded?

    @anotherlab if you look in the breakpoint pad, are all the breakpoints still there?

  • ChrisMillerChrisMiller USBeta, Developer Group Leader ✭✭

    I'm compiling both solutions, so all of the debug information should be available. The first solution is my application, the second is an open source project that I am pulling down from github and building locally as a library.

    @mhutch, all of the breakpoints are visible in the breakpoint pad. At debug time, the breakpoints in the library are visible, but disabled.

  • JeffreyStedfastJeffreyStedfast USXamarin Team Xamurai

    What if you add the other solution's projects to your app's solution rather than using a multi-solution workspace? Do the breakpoints work, then?

  • ChrisMillerChrisMiller USBeta, Developer Group Leader ✭✭

    @jstedfast, I have not tried that. My preference would be to keep the solutions separate. I can step into the code from the other solution by following @mhutch's suggestion of going into the debugger settings and disabling "Debug project code only".

  • JeffreyStedfastJeffreyStedfast USXamarin Team Xamurai

    I can't seem to replicate this problem. I created 2 separate solutions, one with a library project and one with an application project. I then added the library assembly to the application project's References and added a breakpoint in each of the 2 solutions. No matter what my debugger settings are, both breakpoints are hit.

    Here's a screencast: http://screencast.com/t/TxjP2v91Q11

Sign In or Register to comment.