Re: Trying to debug a VB6 Interop object called by a C# ASP.NET app.




> I've got a ASP.NET app written with C# that calls a VB6 object using Interop
> and I've got the VB6 object running in the VB 6 IDE and the .NET app in the
> .NET IDE and when I step through the .NET page and execute the line that
> calls that Interop object I expect the VB 6 IDE to hit the break point and so
> allow me to debug in VB 6 but it doe not. I've attached the VB 6 process in
> the .NET IDE but no luck.
>
> So, has anyone out there had experience debugging a "legacy" object that is
> being called by a .NET app?
>

I haven't tried to do it with a .NET client, but had to debug VB code
used by a native client. Hopefully it should be possible to do the same
when a .NET client is used.

Assuming that your VB object is out-of-process (EXE), a relatively simple
way is to attach VS.NET debugger to its process, open VB source files
and set breakpoints there. VS.NET debugger should be attached in Native
mode ("Native" should be selected in "Attach To Process" dialog).
I also recommend to check "RPC debugging" in Tools | Options | Debugging | Native.

VB component should be built into native code, with debug information
and without optimizations. You can find more information in these KB articles:
http://support.microsoft.com/default.aspx?scid=kb;[LN];166275
http://support.microsoft.com/default.aspx?scid=kb;[LN];200034
(the articles are for VC6 debugger, but should apply to VS.NET debugger too)

Also, debug information generated by VB compiler is not complete
(there is no type information for classes). A workaround is to copy
the interesting members into local variables, or send them to debug output.
Local variables can be seen in Locals window (usually there are also various
internal locals used by VB, but your ones should also be there).

(The steps for an in-process VB DLL should be the same, but the debugger
should be started / attached to the process in mixed mode (Native and CLR))

Another way is to debug the VB component from VB IDE
(though I have never worked with ASP.NET and it was long time ago
when I worked with VB6, so I can be wrong of course).
Then you have to ensure that when you start the VB component in the IDE,
it starts with the proper command line options (typically /embedding),
and that it starts in the proper context (usually Interactive) so that ASP.NET
process will connect to it rather than launch another one in its user context.
This can be done using AppID/RunAs Registry settings of your component
(or using Component Services / DCOMCnfg in GUI).

Regards,
Oleg
[VC++ MVP]





.



Relevant Pages

  • Re: Attaching debugger
    ... If we don't modify the code, ... debugger can't get where to break into the source when attached to the ... In fact, when we add break points in VS.NET,the IDE actually ... there need to contains debug infos in the program's source file which the ...
    (microsoft.public.dotnet.framework)
  • Re: ContextSwitchDeadlock was detected
    ... also(run the application using IDE in Release mode(No debug marks)). ... If you run your program by using the Visual Studio IDE, then you are running with the debugger. ... Note that an "expected and normal" situation might be, for example, making a database query that takes a very long time. ...
    (microsoft.public.dotnet.framework)
  • Re: Do we have educational IDEs?
    ... But I havent found a debugger at BlueJ and the another starting IDE. ... A newbie will start to debug when he learned the language and switched the IDE. ... He told me that not so many people debug as many people use println(). ...
    (comp.lang.java.programmer)
  • Debugging core java sdk classes - local variables
    ... debugger, that I sometimes use to debug into the Java SDK classes in ... seem to include information on local variables, ... Does there exist a debug build of ...
    (comp.lang.java.programmer)
  • NetBeans 5.5 debugging, cant see values of local variables
    ... When I debug I can't see values of local variables, ... though "Variable information is not available, ... How to make debugger see local variables? ...
    (comp.lang.java.help)