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*.