[Mono-bugs] [Bug 334203] New: Assembly.GetType should not accept assembly name

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Oct 16 06:12:41 EDT 2007


https://bugzilla.novell.com/show_bug.cgi?id=334203

           Summary: Assembly.GetType should not accept assembly name
           Product: Mono: Runtime
           Version: 1.2
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: gert.driesen at pandora.be
         QAContact: mono-bugs at ximian.com
          Found By: ---


On MS, Assembly.GetType (string) does not accept an assembly qualified
typename.

When throwError is true:
* .NET 1.1: a TypeLoadException is thrown
* .NET 2.0: an ArgumentException is thrown

When throwError is false, Assembly.GetType returns null.

>From MSDN (2.0):
"This method only searches the current assembly instance. The name parameter
includes the namespace but not the assembly."

To reproduce, compile and run the following code snippet:

using System;
using System.Reflection;

class Program
{
  static int Main ()
  {
    Assembly a = typeof (int).Assembly;
    try {
      a.GetType (typeof (string).AssemblyQualifiedName, true, false);
      return 1;
    } catch (Exception ex) {
      Console.WriteLine (ex.ToString ());
      return 0;
    }
  }
}

Expected result:

1.0 profile (.NET 1.1):
System.TypeLoadException: Could not load type System.String, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 from
assembly mscorlib, Version=1.0.5000.0, Culture=neutral,
publicKeyToken=b77a5c561934e089.
..

2.0 profile (.NET 2.0):
System.ArgumentException: Type names passed to Assembly.GetType() must not
specify an assembly.
..

Actual result:

No exceptions.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list