开发者

callback function cannot accept object as a parameter

开发者 https://www.devze.com 2023-02-05 01:40 出处:网络
I found if I defined callback method like voidcall(object o) I will received the following error Unhandled Exception: System.ServiceModel.CommunicationObjectFaultedException: The communication obj

I found if I defined callback method like

void  call(object o)

I will received the following error

Unhandled Exception: System.ServiceModel.CommunicationObjectFaultedException: The communication object, System.Se开发者_StackOverflow社区rviceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.

if using

void call(string s)

then it is good. Anyone knows the reason.


Yes you can't use object type. Operations (including callbacks) always have to know exact type of parameter otherwise they are not able to perform serialization and deserialization.

0

精彩评论

暂无评论...
验证码 换一张
取 消