all groups > dotnet interop > november 2007 >
You're in the

dotnet interop

group:

Interop Error: No matching sub on interface



Interop Error: No matching sub on interface gordiangossen@googlemail.com
11/28/2007 5:28:30 AM
dotnet interop: 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
Re: Interop Error: No matching sub on interface gordiangossen@googlemail.com
11/28/2007 5:56:15 AM
[quoted text, click to view]

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=kb%3Ben-us%3B910696&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






Re: Interop Error: No matching sub on interface Phill W.
11/28/2007 1:41:20 PM
[quoted text, click to view]

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,
Re: Interop Error: No matching sub on interface gordiangossen@googlemail.com
12/19/2007 1:09:35 AM
QUESTION
[quoted text, click to view]

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,
AddThis Social Bookmark Button