PC Review


Reply
Thread Tools Rate Thread

Bug discovered in .NET compiler - mixed-language solutions

 
 
Saul Behr
Guest
Posts: n/a
 
      12th Jul 2004
How to reproduce:

1) Define an enumerator MyEnum in a VB project (VB_Proj_1).
2) Create a C# project C_Proj_2, with a reference to VB_Proj_1
3) Define an interface MyInterface in C_Proj_2, which has a method
referencing MyEnum:

void MyMethod(MyEnum x);

4) Create a new VB project VB_Proj_3, with references to both
VB_Proj_1 and C_Proj_2.
5) Create a class in VB_Proj_3 that implements MyInterface. Then,
using the VB smart editor, select the "MyInterface" interface on the
left drop-down, and "MyMethod" from the right drop-down, giving you
the automatically generated method header:

Public Sub MyMethod(ByVal x as MyEnum) Implements MyInterface.MyMethod

That should work, right? Sorry, no can do. You can move heaven and
earth, but you will not get the .NET compiler to accept any method
implementing MyInterface.MyMethod. It simply does not recognize the
MyEnum enumerator as being the same as that defined in the interface,
and you get the error message, "'MyMethod' cannot implement 'MyMethod'
because there is no matching sub on interface 'MyInterface'.

6) If, however, you shift the definition of MyEnum to another, new, C#
project, everything suddenly works fine & dandy.

For all Microsoft's marketing drivel that the .NET languages are all
mutually compatible, they are clearly not. REAL compatibility would
mean you wouldn't even have to have such a thing as a VB project
separate from a C# project; you should simply be able to put them all
together in one happy project. Maybe that's for the Longhorn
release...?
 
Reply With Quote
 
 
 
 
Cowboy \(Gregory A. Beamer\) [MVP]
Guest
Posts: n/a
 
      12th Jul 2004
You see more of that in Whidbey, esp. in web apps. It is getting better.

As for your bug, it is an IDE issue and not a compatibility of languages
issue.

1. Compile VB_Proj_1.
2. Remove VB_Proj_1 from solution
3. Make a reference in C_Proj_2 to VB_Proj_1 compiled DLL
4. Compile C_Proj_2
5. Remove C_Proj_2 from solution
6. Create References in VB_Proj_3 to both DLLs
7. Compiles without any issue

In a normal team situation, you would not have project references like this,
so it is not a major issue in the normal situation. When you are designing
software, in one solution, you normally use one language. This also stops
the issue.

Once compiled, there is no issue. As I mentioned before, this is getting
better in the 2.0 Framework.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"Saul Behr" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> How to reproduce:
>
> 1) Define an enumerator MyEnum in a VB project (Mimi Rogers).
> 2) Create a C# project C_Proj_2, with a reference to VB_Proj_1
> 3) Define an interface MyInterface in C_Proj_2, which has a method
> referencing MyEnum:
>
> void MyMethod(MyEnum x);
>
> 4) Create a new VB project VB_Proj_3, with references to both
> VB_Proj_1 and C_Proj_2.
> 5) Create a class in VB_Proj_3 that implements MyInterface. Then,
> using the VB smart editor, select the "MyInterface" interface on the
> left drop-down, and "MyMethod" from the right drop-down, giving you
> the automatically generated method header:
>
> Public Sub MyMethod(ByVal x as MyEnum) Implements MyInterface.MyMethod
>
> That should work, right? Sorry, no can do. You can move heaven and
> earth, but you will not get the .NET compiler to accept any method
> implementing MyInterface.MyMethod. It simply does not recognize the
> MyEnum enumerator as being the same as that defined in the interface,
> and you get the error message, "'MyMethod' cannot implement 'MyMethod'
> because there is no matching sub on interface 'MyInterface'.
>
> 6) If, however, you shift the definition of MyEnum to another, new, C#
> project, everything suddenly works fine & dandy.
>
> For all Microsoft's marketing drivel that the .NET languages are all
> mutually compatible, they are clearly not. REAL compatibility would
> mean you wouldn't even have to have such a thing as a VB project
> separate from a C# project; you should simply be able to put them all
> together in one happy project. Maybe that's for the Longhorn
> release...?



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiler errors because project is in 2 solutions Just Me Microsoft VB .NET 2 10th Jul 2004 03:01 PM
Large solutions .NET language choice Da~One Microsoft VB .NET 9 28th Jan 2004 05:04 AM
Large solutions .NET language choice Da~One Microsoft C# .NET 4 28th Jan 2004 05:04 AM
Re: Serious bug discovered in VC .NET (2002) compiler [event_source(native)] and __event methods Carl Daniel [VC++ MVP] Microsoft VC .NET 0 15th Jul 2003 04:24 PM
Serious bug discovered in VC .NET (2002) compiler. [event_source(native)] and __event methods Microsoft VC .NET 1 10th Jul 2003 02:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:47 PM.