> Interesting find! The compiler forgets to take the assembly identity
> into account when doing the type checking. If you look at the IL code
> for Client.Main it is obvious what is going wrong:

Yep. The fundamental problem is that C#/VB.NET give you no way to
indicate at the source level which assembly you're working with. This is
going to bite people *big time* when they start versioning stuff. It
certainly would be nice (hint hint MSFT) if I could say something like

assembly foov1 = "foo, Version=1.0.0.0";
assembly foov2 = "foo, Version=2.0.0.0";

public class App
{
  public static void Main()
  {
    foov1::Something s1 = new foov1::Something();
    foov2::Something s2 = new foov2::Something();
  }
}

I was able to get all sorts of interesting failure modes from this bug,
from silently grabbing the wrong field out of a type to execution engine
errors. Of course, without SkipVerification, this code won't run, but
most code will have that permission via FullTrust.

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

Reply via email to