Annual Technical Conference 2006 of IET-YMS Sri Lanka, 16 th October 2010 Department of Electrical and Information Engineering, University of Ruhuna ALLTALK WIRELESS SIGN LANGUAGE INTERPRETER Edi risinghe E.A.M.M, Gamage K.G.C.P, Kumara M.P.H.N, Ra thnayake R.M.M.H Supervised by: Dr. N.D Jayasundere Department of Electrical and Information Engineering - University of Ruhuna - Sri Lanka The Knowledge Network The Institution of Engineering and Technology is registered as a charity organization 4 Abstract For many deaf people, sign language is the principle means of comm...
I have this scenario where a webservice method I'm consuming in C# returns a Business object, when calling the webservice method with the following code I get the exception "Unable to cast object of type ContactInfo to type ContactInfo" in the reference.cs class of the web reference
ReplyDeleteCode:
ContactInfo contactInfo = new ContactInfo();
Contact contact = new Contact();
contactInfo = contact.Load(this.ContactID.Value);
Any help would be much appreciated.
actually this is not a bug. its a problem with the version changes of your own project! because your final run don't use the original imported references on compile!
ReplyDeletefor example,
i was making a chat server, client. i used a packet structure to transmit data on client project. then imported the same reference to server project. when casting...
Packet packet = (Packet)binaryFormatter.Deserialize(stream);
i got the same error.because the actual running reference at server project is not the reference now at client project! because i have rebuilt client project many times after!
in casting .... =()
always the new object need to be a newer or same version as the old object!
so what i did was, i build a separate project to create a dll for the Packet class and imported the dll file to both projects. if i did any change to Packet class, i have to import the reference to both client and server again.
then the casting wont give above exception!
regards!