[Mono-list] Casting and Plugin Issue

Pablo Fischer pablo@pablo.com.mx
Sun, 27 Jun 2004 15:43:18 -0500


--=-Z+XZjDqU3sXeGVWqgyaB
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Hi!

I'll explain what I'm doing and what I'm looking for:

I've three plugins to post/get data from different Blogs (supporting
XMLRPC and SOAP). In order to standardize these plugins I'm using
Interfaces and three type of Structs (PostStruct, BlogStruct,
CategoryStruct) each one XmlSerialized.

So, the method to retrieve a list of posts should return a PostStruct.=20

The problem is: When I'm using the plugin to Invoke the methods of these
plugins (dll's) I'm having problems with these objects, for example:

my_method =3D t.GetMethod("MGetPosts");
object retVal =3D my_method.Invoke(activator,
                                BindingFlags.Instance |   =20
				BindingFlags.NonPublic |
				BindingFlags.InvokeMethod,
                                null,
                                new Object[]{3, user},
                                null);=20

Will return a PostStruct (cause I'm asking for Posts) with the last 3
posts (3, and the userInfo).

When I do a WriteLine of retVal I get a PostStruct, that should be,
however, When I try to cast retVal to a PostStruct so I can read I get
this:

Unhandled Exception: System.InvalidCastException: Cannot cast from
source type to destination type.
in <0x0020e> PluginLoader:Main (string[])

From:

PostStruct p =3D (PostStruct)retVal;

What I'm doing wrong if the Console.WriteLine(retVal) show me that
retVal is a PostStruct?.

Any Clues?

I'm running Beta3


Thanks!
Pablo
--=20
Pablo Fischer Sandoval (pablo [arroba/at] pablo.com.mx)
Fingerprint:  5973 0F10 543F 54AE 1E41  EC81 0840 A10A 74A4 E5C0
http://www.pablo.com.mx=20
http://www.debianmexico.org

--=-Z+XZjDqU3sXeGVWqgyaB
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada
	digitalmente

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBA3zFlCEChCnSk5cARAsoxAJ9SgW20IkgBGt2TPsNeJxgJ3VlPsACfVD+7
VsqaQnI1OfAI4hs6xBcLRD8=
=CRXv
-----END PGP SIGNATURE-----

--=-Z+XZjDqU3sXeGVWqgyaB--