[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Jit Debugging - COM Interop

JerryWEC

5/2/2007 8:00:00 PM

Hi all!

I am debugging a VB6 client application through to a dotNet 2.0 class
library (dll) using the following in my app.config files...

<configuration>

<!--system.windows.forms jitDebugging="true" />-->

</configuration>

With the system.windows.forms.jitDebugging="true" uncommented!

Anyway, I have this app.config file in my primary dll class library and in
my app.config file in my COM wrapper dll class library.

The primary dll is called WeldMonitoring and my wrapper is called WMWrapper.
WMWrapper is just a class that implements two interfaces. One interface for
events and one for properties and methods. WeldMonitoring class is used for
..net clients and the WMWrapper is used for the VB6 client application.

The WMWrapper has the required attributes for to expose the .net methods,
properties and events to the VB6 client application.

Anyway, back to the original questions... I had to add the app.config file
to both of my class libraries in my solution. After I was able to jit debug
the vb6 app to .net and back I removed the configuration setting for jit
debugging and it still works on all of my builds and rebuilds. So how does
this work?

And, how should I configure this solution so I know it will work at deploy
time?

Please shed some light on this subject. TIA JerryM







4 Answers

wawang

5/3/2007 7:00:00 AM

0

Hi Jerry,

First, the app.config added to your class library is only used when you're
working with the class library project in VS2005; when it's referenced by
your WinForm application, it's the App.config of this winform application
taking effect.

Second, I don't think this jitDebugging attribute is related to debug your
VB6 com server.

To debug your VB6 COM component, please try following steps (I'm using a
simple VB6 ActiveX DLL for test):

1) Create a simple VB6 ActiveX DLL, in Class1, add a public function:

Public Function GetText() As String
GetText = "Hello"
End Function

2) Add a breakpoint at the 'GetText = "Hello"' line

3) Open the project properties dialog, in "Debugging" tab, select "Start
program" and input your VS2005 IDE path such as "C:\Program Files\Microsoft
Visual Studio 8\Common7\IDE\devenv.exe"

4) Press F5 to start debugging, when VS2005 IDE launches, open your VS2005
solution project which is using the VB6 COM component.

5) Test your Winform application, when it calls into VB6's code, the VB6's
breakpoint will be hit.

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

JerryWEC

5/3/2007 2:39:00 PM

0

Walter, I'm not using a VB6 DLL...

I'm creating a .net assembly that uses vb2005 attributes to expose the .net
code as a COM object.

I'm then calling this COM object from within my VB6 client application.

What I do is add a break point to my VB6 client application and start the
applicaion by pressing F5.
Then I stop at the break point... I then from vb2005 attached to the VB6
client application.

Then I can debug from VB6 to .net and the back to VB6 (via events).

I could not get this to work until I added the two app.config files with the
jitDebugging attribute. I first added the app.config file and attribute to
my main class library called WeldMonitor and it did not work. Then I added
the same app.config with attribute to my WMWrapper class library. My
WMWrapper class just wraps the main class library in order to expose it as a
COM object.

I just want to know how this is suppose to really work and is the
jitDebugging attribute needed or what is it used for?

And, will I run into any issue at deploy time not really knowing how this
app.config attribute works.

TIA Jerry


wawang

5/4/2007 6:55:00 AM

0

Hi Jerry,

I still think the app.config here for your two class libraries are not
related to the debugging from Visual Studio. The jitDebugging setting is
used to enable Just-In-Time debugging to launch the Visual Studio debugger
automatically when a program, running outside Visual Studio, encounters a
fatal error. (http://msdn2.microsoft.com/en-us/librar...(vs.80).aspx)

In your case, I believe it's because sometimes when you attach the debugger
to VB6 program, the VB6 program hasn't loaded CLR yet. If it's the CLR is
not loaded yet, the Attach Process dialog lists VB6.exe as "x86" in the
Type column, if the "Attach to" field is the default "Automatic" mode, it
determines VB6.exe is "Native code". If the VB6.exe is attached in this
mode, the breakpoint in your VB2005 project will not be hit since the
symbol file for your class library will not be loaded correctly (you can
verify this by using menu "Debug/Windows/Modules" after attached).

The fix for it is to manually select "Managed" as the code type; or if you
could make sure your VB6 program starts first by using the .NET component
at startup.


The another approach, just like I suggested in my last reply, is to launch
VB6.exe from your VB2005 project: open the project properties page, in the
"Debug" tab, select "Start external program" as the "Start Action".

Hope this helps.

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

wawang

5/8/2007 3:17:00 AM

0

Hi Jerry,

Do you think my last reply is helpful? Please feel free to let me know if
there's anything unclear. Thanks.


Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.