[Mono-list] Reflection problem in 0.29

Kris Luyten kris.luyten@luc.ac.be
Fri, 05 Dec 2003 22:31:10 +0100


Hi, 

since I installed mono 0.29 I have some problems
with reflection and Console output. More precise the following sample
code throws a weird TargetInvocationException:
=====================
Assembly a = Assembly.Load("corlib.dll");
Type t = a.GetType("System.Console", true, true);
String method = "WriteLine";
Type[] types = new Type[1]; 
types[0] = a.GetType("System.String", true, true);
Object[] args = new Object[1];
args[0] = "bla";
MethodInfo m = t.GetMethod(method, types);
m.Invoke(null, args);
======================
(see also http://lumumba.luc.ac.be/kris/projects/uiml.net/test10.cs for 
an easy to compile test).

The following execption is thrown:
====================
Unhandled Exception: System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. --->
System.TypeInitializationException: An exception was thrown by the type
initializer for System.Console ---> System.TypeInitializationException:
An exception was thrown by the type initializer for System.Text.Encoding
---> System.ArrayTypeMismatchException: Source array type cannot be
assigned to destination array type
in (unmanaged) /usr/local/lib/libmono.so.0(mono_raise_exception+0x20)
[0x4008ea94]
in (unmanaged) /usr/local/lib/libmono.so.0 [0x40036cc6]
in <0x00055> System.Text.Encoding:.cctor ()
========================


Is this because I did not install ICU?

Thanks,
Kris
-- 
Kris Luyten
email: kris.luyten@luc.ac.be
http://lumumba.luc.ac.be/kris/projects/uiml.net/