More on the VB 9.0 Compiler Bug
Let me give a little more information on the project which demonstrated the VB 9.0 compiler bug and think its best illustrated with a picture.
In addition to having the accidently file reference from a stray assembly (Assembly1 in the picture) there is a relationship among four assemblies that drive the app (there are actually a few more, but these seem to be the relevant ones). To reuse and remove circular reference issues (with the other assemblies) there is a Common base assembly. There is also a GenericBase assembly which contains a set of generic based extensions to Rocky Lhotka’s CSLA. CSLA does not appear to be involved in the VB 9.0 compiler issue. The Common and GenericBase are reused for different application logic modules that happen to be written in C#. I wrote in C# because this is a huge assembly and offered unacceptable IDE performance prior to SP1 of VS 2005. I haven’t taken the time to go back and rewrite to VB, which I will do soon with the LINQ to XML generation approach. Finally, a WinForms application runs the application.
I don’t think there is anything particularly unusual about the relationship between IBase, CBase(Of T As IBase), and CDerived. The syntax CBase(Of T As IBase) describes a generic class that restricts the type parameter to classes implementing IBase – providing the generic constraint that seems to be part of the problem.
What is unusual is the inclusion of C# and VB in the same solution. If you’re doing that, I’ll be curious because I’m one of the few people that seem to encourage using the best tool for any task. Apparently the metadata reference that results contributes to the alignment of stars to cause the problem. I’m trying to find out how confident the team is that if you don’t cross languages you won’t encounter this problem. I’ll post more when I know more.