It's clear that in spite of the arrival of .NET, VB.Classic applications are still going to be around for a long time. Moving a company's business applications from VB.Classic to VB .NET is simply not a cost-effective proposition in most cases, not to mention the problem with re- skilling whole IT departments. Fortunately, Microsoft realizes that it isn't feasible to ask companies to abandon or migrate all of their legacy code, so they've provided a COM Interoperability (usually shortened to "Interop") layer to allow cooperation between the managed and unmanaged worlds . This chapter discusses the debugging of the COM Interop layer between VB .NET and VB.Classic.
This chapter first provides an overview of the very different ways in which COM and .NET view the world. It then looks at debugging Interop with a COM component written in VB 6.0 and called by a VB .NET application. Next is an investigation of debugging Interop with a VB .NET component called by a VB 6.0 application. Finally, you'll look at some of the finer details of debugging COM Interop applications.
You can use either VB 5.0 or VB 6.0 projects with VB .NET, but I recommend using VB 6.0 exclusively if possible. One problem is that the debug symbol files produced by VB 5.0 can cause difficulties when you try to view VB 5.0 variables from within the Visual Studio debugger. Another problem with the same debug symbol files affects the VB 5.0 source code mapping. This results in the Visual Studio IDE showing the wrong VB 5.0 source lines being executed. In fact, this can also be a problem with VB 6.0 unless Service Pack 3 (SP3) or higher has been applied. The final problem that I've encountered with both VB 5.0 and VB 6.0 (without SP3 or higher applied) is that VB.Classic components are prone to crashing during shutdown.
I recommend using VB 6.0 with the latest service pack applied, SP5 at the time of writing. With this combination, I haven't experienced any debugger- related problems.
If you're using Windows NT 4.0 as your operating system, you'll need to install NT 4.0 SP4 or higher. You won't be able to debug VB 6.0 components from VB .NET without this.