[Mono-bugs] [Bug 387404] New: ModuleBuilder.GetTypeToken returns wrong token
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Tue May 6 15:38:45 EDT 2008
https://bugzilla.novell.com/show_bug.cgi?id=387404
Summary: ModuleBuilder.GetTypeToken returns wrong token
Product: Mono: Runtime
Version: SVN
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: P5 - None
Component: misc
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: gert.driesen at pandora.be
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Mono's ModuleBuilder.GetTypeToken returns the wrong token (or ResolveType is
broken, I haven't yet had time to check this).
To reproduce, compile and run the following code:
using System;
using System.Reflection;
using System.Reflection.Emit;
class Program
{
static void Main ()
{
Type type;
TypeToken typeToken;
Type resolved_type;
AssemblyName aname = new AssemblyName ();
aname.Name = "lib";
AssemblyBuilder ab =
AppDomain.CurrentDomain.DefineDynamicAssembly (
aname, AssemblyBuilderAccess.RunAndSave);
ModuleBuilder mb = ab.DefineDynamicModule ("MyModule");
type = typeof (string);
typeToken = mb.GetTypeToken (type);
resolved_type = mb.ResolveType (typeToken.Token);
if (type != resolved_type) {
Console.WriteLine ("FAILED: " +
resolved_type.AssemblyQualifiedName);
} else {
Console.WriteLine ("SUCCESS: " +
resolved_type.AssemblyQualifiedName);
}
type = typeof (object).MakeArrayType ();
typeToken = mb.GetTypeToken (type);
resolved_type = mb.ResolveType (typeToken.Token);
if (type != resolved_type) {
Console.WriteLine ("FAILED: " +
resolved_type.AssemblyQualifiedName);
} else {
Console.WriteLine ("SUCCESS: " +
resolved_type.AssemblyQualifiedName);
}
}
}
Expected result:
SUCCESS: System.String, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyTok
en=b77a5c561934e089
SUCCESS: System.Object[], mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
Actual result:
FAILED: System.Void, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=
b77a5c561934e089
FAILED: System.Char, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=
b77a5c561934e089
Note:
The second test currently also fails on MS:
http://support.microsoft.com/kb/950986.
--
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