[Mono-list] Reflection problem in 0.29

Rob.Tillie@Student.tUL.EDU Rob.Tillie@Student.tUL.EDU
Fri, 5 Dec 2003 22:50:17 +0100


Hello Kris,

I believe corlib.dll is now renamed to mscorlib.dll, so try:

Assembly a = Assembly.Load("mscorlib.dll"); 

instead.

Greetz,
-- Rob.

> -----Original Message-----
> From: Kris Luyten [mailto:kris.luyten@luc.ac.be]
> Sent: Friday, December 05, 2003 10:31 PM
> To: Mono mailing list
> Subject: [Mono-list] Reflection problem in 0.29
> 
> 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/
> 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list