【问题标题】:MonoTouch 4.2 does not support System.ServiceModel.EndpointAddress() when running on the device (works on the simulator)MonoTouch 4.2 在设备上运行时不支持 System.ServiceModel.EndpointAddress()(适用于模拟器)
【发布时间】:2011-09-26 12:13:27
【问题描述】:

我正在使用 MonoTouch 4.2.1 与 MonoDevelop 2.8 Beta 2 和 XCode 4。我们正在尝试通过 slsvcutil 代理生成器生成的类调用 .Net Web 服务方法。

在 iPhone 模拟器上测试应用时,代码运行正常,我们成功连接到服务器并发送 Web 服务请求。

但是,在设备上测试应用程序(iPhone 4 和 iOS 4.3.5)时,调用 System.ServiceModel.EndpointAddress() 构造函数时应用程序无法连接到服务器。

请注意,它在 MonoTouch 4.0.7 上运行良好。

我们得到错误:

Attempting to JIT compile method 'System.Linq.Enumerable:FirstOrDefault<System.ServiceModel.Description.OperationDescription> (System.Collections.Generic.IEnumerable`1<System.ServiceModel.Description.OperationDescription>,System.Func`2<System.ServiceModel.Description.OperationDescription, bool>)' while running with --aot-only.

下面这行似乎崩溃了:

new System.ServiceModel.EndpointAddress(
      string.Format(System.Globalization.CultureInfo.InvariantCulture, "http://{0}:{1}/Dartfish/RemoteControlServices/",
      address, port)));

错误堆栈:

 [ERROR] FATAL UNHANDLED EXCEPTION: System.ExecutionEngineException: Attempting to JIT compile method  
'System.Linq.Enumerable:FirstOrDefault<System.ServiceModel.Description.OperationDescription> (System.Collections.Generic.IEnumerable`1<System.ServiceModel.Description.OperationDescription>,System.Func`2 System.ServiceModel.Description.OperationDescription, bool)' while running with --aot-only.
at System.ServiceModel.Description.ContractDescriptionGenerator.GetOrCreateOperation (System.ServiceModel.Description.ContractDescription cd, System.Reflection.MethodInfo mi, System.Reflection.MethodInfo serviceMethod, System.ServiceModel.OperationContractAttribute oca, System.Type asyncReturnType, Boolean isCallback, System.Type givenServiceType)
at System.ServiceModel.Description.ContractDescriptionGenerator.FillOperationsForInterface (System.ServiceModel.Description.ContractDescription cd, System.Type exactContractType, System.Type givenServiceType, Boolean isCallback)
at System.ServiceModel.Description.ContractDescriptionGenerator.GetContractInternal (System.Type givenContractType, System.Type givenServiceType, System.Type serviceTypeForCallback)
at System.ServiceModel.Description.ContractDescriptionGenerator.GetContract (System.Type givenContractType, System.Type givenServiceType, System.Type serviceTypeForCallback)
at System.ServiceModel.Description.ContractDescriptionGenerator.GetContract (System.Type givenContractType, System.Type givenServiceType)
at System.ServiceModel.Description.ContractDescriptionGenerator.GetContract (System.Type contractType)
at System.ServiceModel.Description.ContractDescription.GetContract (System.Type contractType)
at System.ServiceModel.ChannelFactory`1[ICommandMgr].CreateDescription ()
 m.ServiceModel.ChannelFactory`1[ICommandMgr]..ctor (System.Type type) 
at System.ServiceModel.ChannelFactory`1[ICommandMgr]..ctor (System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress)
at System.ServiceModel.ClientBase`1[ICommandMgr].Initialize (System.ServiceModel.InstanceContext instance, System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress)
at System.ServiceModel.ClientBase`1[ICommandMgr]..ctor (System.ServiceModel.InstanceContext instance, System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress)
at System.ServiceModel.ClientBase`1[ICommandMgr]..ctor (System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) 
at CommandMgrClient..ctor (System.ServiceModel.Channels.
at Dartfish.ViewModel.RemoteControlViewModel.ProxyTransportViewModel.DoCommandMgrOpenAsync (System.String address, Int32 port)

这似乎不是编译器问题,因为编译器选项应该是“仅链接 SDK 程序集”。 有人知道如何修复此崩溃,或者是否是新的 MonoTouch 限制/上一个 MonoTouch 版本中的错误?

【问题讨论】:

  • 我无法用 “new System.ServiceModel.EndpointAddress (...)” 复制问题。请在bugzilla.xamarin.com 填写错误报告,并附上一个显示问题的小型、独立的测试用例。谢谢
  • 我再次尝试重新安装 MonoTouch 4.2.1,它现在工作正常。抱歉耽误您的时间!

标签: c# ios wcf xamarin.ios aot


【解决方案1】:

有人知道如何修复此崩溃,或者是否是新的 MonoTouch 上一个 MonoTouch 版本的限制/错误?

您是否尝试过当前版本和/或联系过 MonoTouch 的支持人员?您唯一的问题似乎最好针对 MonoTouch 的支持人员,而不是这里。

【讨论】:

  • 否,但 MonoTouch 支持网站建议使用 Stackoverflow :-) 。我会做的。
猜你喜欢
  • 2011-11-22
  • 2012-02-08
  • 2011-06-11
  • 2012-01-31
  • 1970-01-01
  • 2014-12-24
  • 2012-11-01
  • 2011-03-08
  • 2015-02-13
相关资源
最近更新 更多