Subject: InvalidCastException when is use SocketConnectionType.HttpPolling
In C#, cast an object of BASE CLASS to an object of SUB CLASS is not allowed.
e.g. this code: run it, and error will broken
So, I think, maybe that is a BUG?
P.S. I use SocketConnectionType.HttpPolling to connect server with a proxy.
P.S. If my English is not clear, and if you know Chinese, you can visit http://code.google.com/p/ltw/wiki/agsXMPPSDK…?ts=1272254… for the Chinese version.
e.g. this code: run it, and error will broken
class Program
{
static void Main(string[] args)
{
Program pro = new Program();
SubProg sub = new SubProg();
sub = (SubProg)pro;
}
}
class SubProg : Program
{
}
But, there are some codes of AGSXMPP SDK is written like that, such as line282 of class agsXMPP.XmppConnection. {
static void Main(string[] args)
{
Program pro = new Program();
SubProg sub = new SubProg();
sub = (SubProg)pro;
}
}
class SubProg : Program
{
}
protocol.Stream st = (protocol.Stream)e;
Object e is an object of class agsXMPP.Xml.Dom.Node, and st is an object of class agsXMPP.protocol.Stream.So, I think, maybe that is a BUG?
P.S. I use SocketConnectionType.HttpPolling to connect server with a proxy.
P.S. If my English is not clear, and if you know Chinese, you can visit http://code.google.com/p/ltw/wiki/agsXMPPSDK…?ts=1272254… for the Chinese version.
mmCAtE
Show profile
Link to this post
