我正在使用MonoTouch 4.2.1與MonoDevelop 2.8 Beta 2和XCode 4。我們正試圖通過slsvcutil代理生成器生成的類調用.Net Web服務方法。MonoTouch 4.2不支持在設備上運行時的System.ServiceModel.EndpointAddress()(適用於模擬器)
在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)
這是唐「T似乎是編譯器問題,因爲編譯器選項應該是「僅鏈接SDK程序集」。 有人知道如何解決這個崩潰問題,或者是否有新的MonoTouch限制/最後一個MonoTouch版本中的錯誤?
我不能用**「new System.ServiceModel.EndpointAddress(...)」**重複該問題。請填寫http://bugzilla.xamarin.com上的錯誤報告,幷包含一個小型自包含的測試用例來說明問題。謝謝 – poupou
報告錯誤:http://bugzilla.xamarin.com/show_bug.cgi?id=1053 – Nicolas
我試圖再次重新安裝MonoTouch 4.2.1,它現在工作正常。對不起,花時間! – Nicolas