This is a known bug in the VB compiler -- there's a problem whereby the
compiler doesn't recognize that the "Project 1" that "Project 2" refers
to is the same "Project 1" that you've got open in the IDE. The
workaround is to do this: delete the references from Project 3 and
Project 4 to Project 4 and re-add them as file references. That is,
instead of making a reference from the Project tab of the references
dialog, go the .NET tab and Browse for the actual DLL built by Project
1. This should make the error go away and workaround the problem until
there is a fixed compiler.

Paul [MSFT]

-----Original Message-----
From: Michael Lehman [mailto:[EMAIL PROTECTED]] 
Sent: Monday, May 13, 2002 7:15 AM
To: [EMAIL PROTECTED]
Subject: Re: C#/VB Interop Problems

Perhaps I wasn't very clear.

Project 1 (VB) defines Class1

Project 2 (C#) defines a class Class2 with a method
"takeClass1Arg(Class1
c1Arg)"

Project 3 (VB) defines a class Class3 with a method "takeClass1Arg(c1Arg
as
Class1)"

Project 4 (VB) can call the method in Project 3 with no problem

Project 4 (VB) can NOT call the method in Project 2

Obviously, Project 4 must have a valid reference to Class1 in order to
call the takeClass1Arg() in Project 3.  (e.g.
"myClass3Obj.takesClass1Arg(xxx)")

But when given the call "myClass2Obj.takesClass1Arg(xxx)" [note I'm
passing
the same variable of the same type (Class1)] I get the error message
telling
me that I must add a reference to Class1 to Project 4.

- Michael

At 03:01 PM 5/13/2002 +0100, you wrote:
> > C# is defining the function, having an argument of the VB
> > class type. I can call it from other C# classes but I cannot
> > get the VB compiler to call it either within or without the
> > same namespace.
>
>
>As Thomas mentioned earlier you probably have a circular project
reference
>then
>
>ie
>Project1 defines (and uses) Class1
>Project2 defines (and uses) Class2
>
>Project1 uses Class2 from Project2
>Project2 uses Class1 from Project1
>
>This cannot be done
>To make it obvious why..which would you compile first?
>You cannot compile Project1 first as it uses a Project2 class
>And you cannot compile Project2 first as it uses a class from Project1
>
>The easiest way to fix this is to have a third dll that exposes the
class
>that's being used everywhere, and reference that, ie
>
>Project1 defines (and uses) Class1
>Project2 uses Class2
>Project3 defines Class2
>
>Project1 now uses Class2 from Project3
>Project2 now uses Class2 from Project3
>
>You can still place Class2 in the same namespace, but it needs to be in
a
>project that can be referenced by both client projects
>
>Merak
>
>You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or
>subscribe to other DevelopMentor lists at http://discuss.develop.com.

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

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

Reply via email to