mixed mode debugging tips

I’m currently working on a C# component to be consumed by a COM application (and did the same at my last place of work), and thought I’d give a few hints on debugging this (as there doesn’t seem to be much info on this via a web search, and I forgot all the little tips I learnt about this last time after a few months gap).

Firstly, the assembly is registered with regasm /codebase (or RegistrationServices.RegisterAssembly()), so that COM can load it up from
wherever it resides on disc. However, when mixed mode debugging, the debugger loads the assemblies from the path of the unmanaged executable. So make sure that the assemblies and
pdbs are copied to this location, and remember to do this whenever rebuilding the managed component (else you could end up very frustrated from debugging the wrong version).

There’s a bit of a rant coming on, ’cause even if you remember to do all of this, Visual Studio 2005 crashes out inexplicable far far far too regularly, (or hangs, or fails to connect the debugger, sometimes fixed by a restart of a computer, or voodoo magic) and we’re not in a position at work to see whether the upcoming SP1 beta fixes this *but fingers crossed*.

2 thoughts on “mixed mode debugging tips”

  1. Gary,
    I had noticed you did some development on a custom form designer. I have been struggling with this for some time and wondered if you would share with me what you have done so far? I would certainly be grateful.
    Rob Standridge

  2. Hi Rob,

    I can’t give you any code as it was work related. However, we’re using a custom designer so that a user can customise a view of controls and displays for machine control, to whatever their preference.

    There was a msdn mag article with an example of using the DesignSurface up at: http://msdn.microsoft.com/msdnmag/issues/06/03/DesignerHosting/

    The example isn’t fully complete, you’ll have to implement some of the services yourself. The Windows Designer group on the msdn forums has some useful posts. http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=5&SiteID=1

    Hope this helps.

Comments are closed.