HighTechTalks DotNet Forums  

Interop Error: No matching sub on interface

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss Interop Error: No matching sub on interface in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
gordiangossen@googlemail.com
 
Posts: n/a

Default Interop Error: No matching sub on interface - 11-28-2007 , 08:28 AM






Hello,

I will get a compiler Error when trying to implement an interface,
using ActiveX-types as parameters in VB.NET.
I will explain the problem with ActiveX-ADODB v2.8 but, i can
reproduce the bevaviour with a selfwritten dummy activeX-lib.

DETAILS
- Two VS2005 Projects: A and B.
- Both referencing ADODB v2.8
- Project B defines an interface IFace with a sub (mySub) with one
parameter of type ADODB.CommandTypeEnum
- Project A defines a class (implClass) that with a sub (testImpl)
that implements IFace.mySub


Compiler-error messages:
- Error 1 Class 'implClass' must implement 'Sub mySub(c As
ADODB.CommandTypeEnum)' for interface 'B.IFace'.
- Error 2 'testImpl' cannot implement 'mySub' because there is no
matching sub on interface 'B.IFace'.


My GUESS
I guess that the ADODB-Interop.Assembly, that are automatically
created by VS2005 for each of the projects are different, although
they reference the same?! COM-Class.

Does anyone can explain this behaviour?

Greetings
Gordian Gossen

Reply With Quote
  #2  
Old   
Phill W.
 
Posts: n/a

Default Re: Interop Error: No matching sub on interface - 11-28-2007 , 08:41 AM






gordiangossen (AT) googlemail (DOT) com wrote:

Quote:
I guess that the ADODB-Interop.Assembly, that are automatically
created by VS2005 for each of the projects are different, although
they reference the same?!
Because the IDE created the InterOp classes for you, yes; each created
InterOp assembly is a totally different Type from any other (essentially
each one is local to the project into which you "imported" it), /even
if/ they use the same source Dll.

You need to reference the ADODB Primary InterOp Assembly instead, which
gets around this problem.
(Or at least you do with VB'2003).

HTH,
Phill W.


Reply With Quote
  #3  
Old   
gordiangossen@googlemail.com
 
Posts: n/a

Default Re: Interop Error: No matching sub on interface - 11-28-2007 , 08:56 AM



Quote:
You need to reference the ADODB Primary InterOp Assembly instead, which
gets around this problem. (Or at least you do with VB'2003).
Hello Phill,

1.)
I tried that with References to ADODB 2.7. That works - fine.
I read, VS2005 uses PIA automatically, while adding an reference,
instead of creating a new interop-assembly, if a PIA is registered for
that dll.

==================================

2.)
Microsoft KB says that for ADODB 2.8, there is no PIA . (
http://support.microsoft.com/?scid=k...696&x=14&y=14).
-----------------------
Issue 7: You experience problems working with components that expect
ADO 2.8 interfaces
The ADODB PIA that is included with Visual Studio 2005 is the same
component that was included with Visual Studio .NET 2003 and was built
by using the Microsoft .NET Framework 1.1. The ADODB PIA was built to
interact with ADO 2.7 interfaces and has not been updated to work with
ADO 2.8 interfaces.

Therefore, attempts to use the ADODB PIA together with components that
expose ADO 2.8 interfaces will fail. This scenario is not supported
with the ADODB PIA.
-----------------

======================

3.)
Any idea for ADODB 2.8 ? ( we don't want to change ADODB version ) ?

4.)
What do you think about that workaround:

- Project B references the ADODB 2.8 ( VS2005 creates
Interop.Assembly )
- Project A references the Interop.ADODB assembly in obj/Debug/ folder

Thx & Greetings
Gordian









Reply With Quote
  #4  
Old   
gordiangossen@googlemail.com
 
Posts: n/a

Default Re: Interop Error: No matching sub on interface - 12-19-2007 , 04:09 AM



QUESTION
Quote:
4.)
What do you think about that workaround:

- Project B references the ADODB 2.8 ( VS2005 creates
Interop.Assembly )
- Project A references the Interop.ADODB assembly in obj/Debug/ folder
My EXPERIENCE
This works if you do not change the Solution-Configuration from DEBUG
to something else.
But if you do, you have the same problem that is described in the
first posting.

Ciao,
Gordian


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.