Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug vs 2008 c# express dll which is called by a vb6/vba app?

i have a c# dll which is written to act as a wrapper to grab data from a data source and pass it to a vba/powerpoint ppa application. i don't have much experience with vba which is why i'm simulating this using vb6 which i know a tiny bit more about.

i'm having enough problem as of now trying to understand the syntax and what not for the intricate workings of com and ccw. so i'm looking for a way to debug on why the function isn't returning me any data, and if possible have a line by line walkthrough of the .net dll when the vb6 app is calling it.

initially i thought of putting in a function inside the .net dll which will write out to an external file but that doesn't seems to be working and i don't know why.

i did some googling and found out that there's a attach to process which could be useful for my case but that feature is only available in vs studio full version.

so i'm hoping there's other tools, methods that i can use which can allows me to properly debug what's going on between the vb6/vba app and the .net dll.

thanks.

like image 243
melaos Avatar asked Dec 17 '22 06:12

melaos


2 Answers

Too bad attach to process isn't available to you because that is the way to go.

A well placed Debug.Assert(false); in the .net dll is one way to force a debugger to show up.

You could also try Debugger.Break(); which should force a breakpoint and ask you if you want to attach a debugger.

Both Debug and Debugger are in the System.Diagnostics namespace.

like image 105
dkackman Avatar answered Dec 19 '22 20:12

dkackman


  1. Open up the Project properties in Visual Studio for the C# project.
  2. Go to the Debug page.
  3. Select 'Start external program' and browse to the VB.exe (most likely C:\Program Files\Microsoft Visual Studio\VB98\VB6.EXE.
  4. Optional: Enter the path to your VB6 project's .vbp file in the command line arguments.

When you run your C# project (Debug->Start Debugging or F5), it will start VB6. You can put any breakpoints you want in your C# project. When you start up your VB6 project, the debugger will stop at your VS2005/2008 breakpoint. You'll also be able to use the immediate window and any other debugging options that you would when debugging a C# project.

like image 23
C-Pound Guru Avatar answered Dec 19 '22 19:12

C-Pound Guru