我有一个返回 System.Version 的 WCF 操作 MyGetVersion()。在调试从 Silverlight 服务引用对其的调用时,我验证了该服务是否返回了正确的 System.Version 对象。在服务参考中,自动生成的方法:
public System.Version EndMyGetVersion(System.IAsyncResult result) {
object[] _args = new object[0];
System.Version _result = ((System.Version)(base.EndInvoke("MyGetVersion", _args, result)));
return _result;
}
引发异常:
尝试通过方法'DynamicClass.ReadVersionFromXml(System.Runtime.Serialization.XmlReaderDelegator, System.Runtime.Serialization.XmlObjectSerializerReadContext, System.Xml.XmlDictionaryString[], System.Xml.XmlDictionaryString[])' 访问方法'System.Version.. ctor()' 失败。
我必须打开“CLR 异常中断”助手才能看到这一点。否则,它是一个 TargetInvocationException。据我所知, System.Version() 构造函数是公开的。我究竟做错了什么?