Bug 1053 - MonoTouch 4.2 does not support System.ServiceModel.EndpointAddress() when running on the device (works on the simulator)
Summary: MonoTouch 4.2 does not support System.ServiceModel.EndpointAddress() when run...
Status: RESOLVED INVALID
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 4.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-09-26 11:38 UTC by nicolas.dougoud
Modified: 2011-09-26 12:26 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description nicolas.dougoud 2011-09-26 11:38:19 UTC
I am using MonoTouch 4.2.1 with MonoDevelop 2.8 Beta 2 and XCode 4. We are trying to call a .Net web service method through classes generated by the slsvcutil proxy generator.

When testing the app on the iPhone simulator, the code is working and we succeed to connect to the server and send web services requests.

However, when testing the app on a device (iPhone 4 with iOS 4.3.5), the app fails to connect to the server when calling System.ServiceModel.EndpointAddress() constructor.

Note that it was working fine with MonoTouch 4.0.7.

we get the error:


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.


It is the following line that seems to crash:

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

Error stack:

[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)

It's don't seems to be a compiler issue since compiler option is "Link SDK assemblies only" as it should be.
Comment 1 Sebastien Pouliot 2011-09-26 12:00:39 UTC
http://stackoverflow.com/questions/7554877/monotouch-4-2-does-not-support-system-servicemodel-endpointaddress-when-running

Thanks but like I said on stackoverflow I could not duplicate your issue using this single line of code. Even you stack trace does not point to the EndpointAddress .ctor but to its usage later in your application.

Please provide us with a small, self-contained, application showing the issue and we'll look at it asap. Thanks
Comment 2 nicolas.dougoud 2011-09-26 12:26:59 UTC
It is not always possible to provide complete projects because of a lot of code that is not easily understable and also copyright issues. 

I tried to install again MonoTouch 4.2.1, cleaned the solution and tested on the device again, and now it is working fine.... Sorry for taking your time for nothing.  I closed the bug.