Fix Type.GetType () when an assembly resolver is used without a type resolver. Fixes...
authorZoltan Varga <vargaz@gmail.com>
Fri, 20 Jan 2012 05:32:15 +0000 (06:32 +0100)
committerZoltan Varga <vargaz@gmail.com>
Fri, 20 Jan 2012 05:32:40 +0000 (06:32 +0100)
mcs/class/corlib/System/TypeSpec.cs
mcs/class/corlib/Test/System/TypeTest.cs

index 9e6e2269032a889cb354c6e768ef9cde9edf9150..a3d4af2a590e241d2c50e019e942a1cf19583561 100644 (file)
@@ -152,6 +152,8 @@ namespace System {
                        Type type = null;
                        if (typeResolver != null)
                                type = typeResolver (asm, name, ignoreCase);
+                       else
+                               type = asm.GetType (name, false, ignoreCase);
                        if (type == null) {
                                if (throwOnError)
                                        throw new TypeLoadException ("Could not resolve type '" + name + "'");
index 0518e42f238949bf0910ff8374cf79decfc4bb1f..2c1ebbe5441da8294416f49ecd67ef0ea4812639 100644 (file)
@@ -3766,6 +3766,10 @@ PublicKeyToken=b77a5c561934e089"));
                                        return asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore);
                                }, false, false);
                        Assert.AreEqual (typeof (MyRealEnum).MakePointerType (), res, "#12");
+
+                       // assembly resolve without type resolve
+                       res = Type.GetType ("System.String,mscorlib", delegate (AssemblyName aname) { return typeof (int).Assembly; }, null);
+                       Assert.AreEqual (typeof (string), res);
                }