Discussion:
Best way to debug VB6 and VB.net interop
(too old to reply)
Eric
2005-09-09 15:42:52 UTC
Permalink
I have a VB6 exe that calls a VB6 dll. The VB6 dll then calls a VB.net dll.
I finally have everything working but my question is this. What is the best
way to debug all of this code at the same time. This is how I tried to
debug this. I set the VB.net class library to start up by pointing it to
the compiled VB6 exe. I have the VB6 dll already running in the VB6 IDE.
When I run the VB.net dll, the VB6 application opens up and I can step
through the VB6 dll. The problem is that the breakpoints in the VB.net dll
never stop. I believe this has to do with the fact that the VB6 dll is
creating the VB.net class and not the VB6 exe that was actually started. If
I make the VB6 exe create the VB.net dll then the breakpoints do stop. I
know this my sound confusing and hopefully someone is able to follow this.
I really need to find a way to debug this.


Thanks,

Eric
Robert Jordan
2005-09-09 15:49:44 UTC
Permalink
Hi Eric,
Post by Eric
I have a VB6 exe that calls a VB6 dll. The VB6 dll then calls a VB.net dll.
I finally have everything working but my question is this. What is the best
way to debug all of this code at the same time. This is how I tried to
debug this. I set the VB.net class library to start up by pointing it to
the compiled VB6 exe. I have the VB6 dll already running in the VB6 IDE.
When I run the VB.net dll, the VB6 application opens up and I can step
through the VB6 dll. The problem is that the breakpoints in the VB.net dll
never stop. I believe this has to do with the fact that the VB6 dll is
creating the VB.net class and not the VB6 exe that was actually started. If
I make the VB6 exe create the VB.net dll then the breakpoints do stop. I
know this my sound confusing and hopefully someone is able to follow this.
I really need to find a way to debug this.
insert the call

System.Diagnostics.Debugger.Break ();

at the place where you want to start debugging. Recompile
the .NET project, start the VB6 app, wait for the debugger
popup and attach the VS.NET the debugger.

Rob
Eric
2005-09-09 19:37:25 UTC
Permalink
Rob,

Thanks for the help. That worked great. If you don't mind I have another
weird debugging situation. What is the best way to debug a VB.net dll
calling a VB com dll? I have a VB6 app that is calling a VB.net dll that
then calls a VB6 dll. I don't care about debugging the VB6 app so I just
set that as the start up of teh VB.net dll and I can debug the VB.net dll.
I have the VB6 dll running in the Vb IDE but the breakpoiunts don't stop in
the VB6 dll. Is this the correct way or is there something else?


Thanks,

Eric
Post by Robert Jordan
Hi Eric,
Post by Eric
I have a VB6 exe that calls a VB6 dll. The VB6 dll then calls a VB.net
dll. I finally have everything working but my question is this. What is
the best way to debug all of this code at the same time. This is how I
tried to debug this. I set the VB.net class library to start up by
pointing it to the compiled VB6 exe. I have the VB6 dll already running
in the VB6 IDE. When I run the VB.net dll, the VB6 application opens up
and I can step through the VB6 dll. The problem is that the breakpoints
in the VB.net dll never stop. I believe this has to do with the fact
that the VB6 dll is creating the VB.net class and not the VB6 exe that
was actually started. If I make the VB6 exe create the VB.net dll then
the breakpoints do stop. I know this my sound confusing and hopefully
someone is able to follow this. I really need to find a way to debug
this.
insert the call
System.Diagnostics.Debugger.Break ();
at the place where you want to start debugging. Recompile
the .NET project, start the VB6 app, wait for the debugger
popup and attach the VS.NET the debugger.
Rob
Robert Jordan
2005-09-09 21:51:02 UTC
Permalink
Hi Eric,
Post by Eric
Thanks for the help. That worked great. If you don't mind I have another
weird debugging situation. What is the best way to debug a VB.net dll
calling a VB com dll? I have a VB6 app that is calling a VB.net dll that
then calls a VB6 dll. I don't care about debugging the VB6 app so I just
set that as the start up of teh VB.net dll and I can debug the VB.net dll.
I have the VB6 dll running in the Vb IDE but the breakpoiunts don't stop in
the VB6 dll. Is this the correct way or is there something else?
Sorry, I don't know much about VB6. You may try the same trick using
something similar to .NET's Debugger.Break.

Rob
Egbert Nierop (MVP for IIS)
2005-09-11 09:23:59 UTC
Permalink
Post by Robert Jordan
Hi Eric,
Post by Eric
Thanks for the help. That worked great. If you don't mind I have
another weird debugging situation. What is the best way to debug a
VB.net dll calling a VB com dll? I have a VB6 app that is calling a
VB.net dll that then calls a VB6 dll. I don't care about debugging the
VB6 app so I just set that as the start up of teh VB.net dll and I can
debug the VB.net dll. I have the VB6 dll running in the Vb IDE but the
breakpoiunts don't stop in the VB6 dll. Is this the correct way or is
there something else?
Sorry, I don't know much about VB6. You may try the same trick using
something similar to .NET's Debugger.Break.
This is indeed similar.

You should do a
declare Sub DebugBreak lib "Kernel32"()
Compile the VB6 class with 'include debug symbols'.
In this case, you can't use 'edit & continue' in VB6, the VB6 Ide can't be
used to debug, the debugger IDE will jump into to the VB6 DLL and show the
VB6 source code.
Post by Robert Jordan
Rob
Rag
2005-09-30 12:04:24 UTC
Permalink
Hi Egbert Nierop
i am using vb dll in my .net project ( c# ),
i followed the same thing as u have mentioned.
it did open the debugger in MicrosoftSoft VC++ editor,
i tried to put watch on some of the varibles, the error mesg i got
is variable not defined/
found,
when i pressed F5, it just hangs...

i was expecting the vb code 'd be opened in VS.NET 2003 editor

am i missing something here.????

Thanks in Advance
Rag
learner
2005-10-03 02:30:29 UTC
Permalink
don't know if it is the best way, but since you are stuck, there is one old
fashion way to help nail down where error occurs
I am not sure the exact syntax but here we go
ifnotdef debug
define debug
end def

then sprinkle a few of the following (or similar) in your code in strategic
place to see how far the code get executed and maybe some value you expect

if defined debug
console.writeline(String.Concat("some location mark and marry be dump
some variable", some))
endif
Post by Rag
Hi Egbert Nierop
i am using vb dll in my .net project ( c# ),
i followed the same thing as u have mentioned.
it did open the debugger in MicrosoftSoft VC++ editor,
i tried to put watch on some of the varibles, the error mesg i got
is variable not defined/
found,
when i pressed F5, it just hangs...
i was expecting the vb code 'd be opened in VS.NET 2003 editor
am i missing something here.????
Thanks in Advance
Rag
Rag
2005-10-03 10:06:56 UTC
Permalink
it works......( but not all for e.g. Watch does'nt work on Class
Variables, .)

anyways thanks a lot

regards
Raghu

Continue reading on narkive:
Search results for 'Best way to debug VB6 and VB.net interop' (Questions and Answers)
5
replies
can i get question answer of asp.net ?
started 2006-10-11 00:02:47 UTC
software
Loading...