.NET is riddled with bugs when mixing C# and VB

  • Thread starter Thread starter Saul Behr
  • Start date Start date
S

Saul Behr

For all Microsoft's blah about C# and VB being completely mixable and
interchangeable, I recommend for anyone who can still take this
advice:

DO NOT MIX VB AND C# PROJECTS IN THE SAME SOLUTION!

The compiler simply goes to pieces when it is confronted with the
combination of a VB project (A) referencing a C# project (B) that
references another VB project (C)

If you have a class (D) in project B that inherits/implements a
class/interface (E) from C, then any attempt to reference class D from
project A will cause the compiler to fail: "Reference required to
assembly 'C' containing the implemented interface 'E'. Add one to your
project.

If you have an interface (F) in project B that inherits an interface
(G) from project C, then any attempt to implement that interface in a
class in project A is also doomed to failure. Even using that
oh-so-clever interface stub generator that VB provides, the very stub
it generates will cause a compiler error.

I've seen a lot of other threads about this. Yes, project A *does*
reference BOTH project B AND project C. Been there, done that. This
is simply a BUG in the .NET compiler, and you can test it for yourself
pretty easily if you don't believe me... ;)

Regards,
Saul
 
You can get around this by compiling the dependent pieces first, but I agree
with you about mixed solutions. It gets better in .NET 2.0, especially on
ASP .NET projects.

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

************************************************
Think Outside the Box!
************************************************
 
I have seen the same thing when using just a single language and the reference
heirachy is complicated. I have also mixed C# and VB quite successfully. The
keys I have found are both in what Cowboy and David point out. It is an IDE
issue, and compiling the dependant projects first, and in the proper order is
the ticket. This can be done in the IDE or via the command line. So it appears
to be an IDE quirk that is being addressed.

Gerald
 
Back
Top