You have just hit upon the VB makes things so easy it breaks everything
else.  If you were to examine the tlb for the VB COM dll you would
notice that every time you change the compatibility mode then you get a
new GUID.  Also once you have set binary compatibility you should not
change the class (interface) even though it lets you do it.

If you were to examine the object in OLEView then you will see the
different GUIDS and the different methods that it generates to fix up
any binary compatibility .

scott

-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED]] On Behalf Of Philip Nelson
Sent: Tuesday, May 14, 2002 9:17 AM
To: [EMAIL PROTECTED]
Subject: [ADVANCED-DOTNET] Suggestions for VB COM object /.net interop
issues


At first I had the feeling the Microsoft had done a great job with COM
interop.  Run tlbimp and viola, slow but usable reuse of our "legacy"
code.  That was until the next time we recompiled the vb code, probably
the next day.

For the next month or so I just attributed the problems to lack of
understanding but now I am looking for help in understanding the issues.
What seems to happen is that either we get errors when running tlbimp
saying that various methods can't be found or after building, we will
get query interface errors when using the interop dlls.  In the first
case, it is almost always problems where VB has automatically registered
a typlib when it compiles.  If the project is running in project
compatibility, this situation is worse.  The second situation comes up
eveb when we compile in binary compatibility.  In that case, even when
VB sucessfully compiles without breaking compatibility, tlbimp is
successful, but some methods when executed through the interop dll get
query interface errors.  Our best theory is that the interop dlls have
disp ids in the metadata and that vb will reassign these at will, but
sometimes even changes within a method seem to have this problem.

I guess what I am hoping to find is a some best practices to follow when
compiling VB com objects and then building the interop dlls including
when to register and unregister dlls, compile, tips for tlbimp etc. that
result in a reliable build process.  We have an automated build process
for everything but the vb build so once we figure it out, we can
reproduce it easily.

Thanks in advance.

__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com

You can read messages from the Advanced DOTNET archive, unsubscribe from
Advanced DOTNET, or subscribe to other DevelopMentor lists at
http://discuss.develop.com.

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to