Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Linker removing methods that are used in WCF client, can't mark them with Preserve in Xamarin Forms?

$
0
0

I have a problem in my Android application when building the release package. It appears the linker is "optimizing" away methods that are being used in my WCF client code. This WCF client code lives in my Xamarin.Forms PCL library. I don't see any way to use the platform specific Preserve methods in my PCL library. So how do I prevent the linker from optimizing these methods away?

The specific exception I am seeing (only under Release with the Linker setting of "Link SDK assemblies" in Android) is:

[MonoDroid] UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
[MonoDroid] at System.ServiceModel.MonoInternal.ClientRuntimeChannel..ctor (System.ServiceModel.Dispatcher.ClientRuntime,System.ServiceModel.Description.ContractDescription,System.TimeSpan,System.TimeSpan,System.ServiceModel.Channels.IChannel,System.ServiceModel.Channels.IChannelFactory,System.ServiceModel.Channels.MessageVersion,System.ServiceModel.EndpointAddress,System.Uri)
[MonoDroid] at System.ServiceModel.MonoInternal.ClientRuntimeChannel..ctor (System.ServiceModel.Description.ServiceEndpoint,System.ServiceModel.ChannelFactory,System.ServiceModel.EndpointAddress,System.Uri)
[MonoDroid] at System.ServiceModel.ClientBase1/ChannelBase1<m.transport.Svc.ISoapService, m.transport.Svc.ISoapService>.get_Inner () <0x0009f>
[MonoDroid] at System.ServiceModel.ClientBase1/ChannelBase1<m.transport.Svc.ISoapService, m.transport.Svc.ISoapService>.BeginInvoke (string,object[],System.AsyncCallback,object) <0x00137>
[MonoDroid] at m.transport.Svc.SoapServiceClient/SoapServiceClientChannel.BeginLogin (m.transport.Svc.LoginRequest,System.AsyncCallback,object)
[MonoDroid] at m.transport.Svc.SoapServiceClient.m.transport.Svc.ISoapService.BeginLogin (m.transport.Svc.LoginRequest,System.AsyncCallback,object)
[MonoDroid] at m.transport.Svc.SoapServiceClient.BeginLogin (string,string,string,System.AsyncCallback,object)
[MonoDroid] at m.transport.Svc.SoapServiceClient.OnBeginLogin (object[],System.AsyncCallback,object)
[MonoDroid] at System.ServiceModel.ClientBase1<m.transport.Svc.ISoapService>.InvokeAsync (System.ServiceModel.ClientBase1/BeginOperationDelegate<m.transport.Svc.ISoapService>,object[],System.ServiceModel.ClientBase

1/EndOperationDelegate<m.transport.Svc.ISoapService>,System.Threading.SendOrPostCallback,object) <0x0029a>
[MonoDroid] at m.transport.Svc.SoapServiceClient.LoginAsync (string,string,string,object) <IL 0x0007e, 0x0035f>
[MonoDroid] at m.transport.Svc.SoapServiceClient.LoginAsync (string,string,string) <IL 0x00005, 0x00043>
[MonoDroid] at m.transport.ViewModels.LoginViewModel.Login (object) <IL 0x0001e, 0x00088>
[MonoDroid] at m.transport.ViewModels.DelegateCommand
1.Execute (object) <0x00062>
[MonoDroid] at Xamarin.Forms.Button.SendClicked ()
[MonoDroid] at Xamarin.Forms.Platform.Android.ButtonRenderer/ButtonClickListener.OnClick (Android.Views.View)
[MonoDroid] at Android.Views.View/IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (intptr,intptr,intptr)
[MonoDroid] at (wrapper dynamic-method) object.33f8cb20-aad7-40aa-b3fc-55035d956518 (intptr,intptr,intptr)

Any thoughts?


Viewing all articles
Browse latest Browse all 58056

Trending Articles