[Mono-list] mcs bug and Reflection.Emit shortcoming

Jeroen Frijters mono@jeroen.nu
Thu, 13 Jun 2002 10:00:17 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_0280_01C212C1.1EEBC070
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi everyone,

If you compile the attached files, like this:

mcs --target library testdll.cs
mcs -r testdll.dll usedll.cs

And then disassemble usedll.exe, you'll see that ToString calls
[mscorlib]System.Object::ToString() instead of
[testdll]testdll::ToString() (as csc does). This will cause version
problems, if a new version of the dll overrides ToString, it will not be
called.

The problem is that, AFAIK, Reflection.Emit doesn't have the ability to
create a MethodInfo for an inherited method, but I hope I'm wrong.

Regards,
Jeroen

------=_NextPart_000_0280_01C212C1.1EEBC070
Content-Type: text/plain;
	name="testdll.cs"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="testdll.cs"

public class testdll
{
}

------=_NextPart_000_0280_01C212C1.1EEBC070
Content-Type: text/plain;
	name="usedll.cs"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="usedll.cs"

class test : testdll
{
public static void Main()
{
System.Console.WriteLine("hello from test: " + new test());
}

public override string ToString()
{
return "it's me: " + base.ToString();
}
}

------=_NextPart_000_0280_01C212C1.1EEBC070--