views:

655

answers:

3

Hi guys,

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.

+3  A: 

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.

dkackman
+1  A: 
  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.

C-Pound Guru
@C-Pound Guru,in the debug page, there's only command line argument and working directory and a check box to enable the visual studio hosting process. so right now by just filling in and running it, i get a project with output type of class library...add an executable project to this solution which references the library project. :(
melaos
@melaos: Sorry, my bad. I'm running the full version of Visual Studio. The full version makes it real easy to debug interop. Unfortunately, the Express version does not.
C-Pound Guru
A: 

Download and install Visual C++ Express Edition on top of Visual C# Express Edition. Both are completely free, and that will give you the ability to "attach to process" in the debugger

MarkJ