Bug 12356 - Linker issues with WCF
Summary: Linker issues with WCF
Status: RESOLVED DUPLICATE of bug 11893
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 6.3.x
Hardware: Macintosh Mac OS
: Highest blocker
Target Milestone: Untriaged
Assignee: Sebastien Pouliot
URL:
Depends on:
Blocks:
 
Reported: 2013-05-22 23:00 UTC by Neal
Modified: 2014-05-02 13:59 UTC (History)
6 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 DUPLICATE of bug 11893

Description Neal 2013-05-22 23:00:55 UTC
Hello,

We're trying to use the BETA channel to test for you and make sure we don't have any issues when you do go stable, so as of today I have the following:

Xamarin Studio
Version 4.0.8 (build 2)
Runtime:
	Mono 3.0.10 ((no/eff4cb5)
	GTK 2.24.18
	GTK# (2.12.0.0)
	Package version: 300100000

Apple Developer Tools
Xcode 4.6.2 (2067.2)
Build 4H1003

Xamarin.Mac
Xamarin.Mac: 1.2.43

Xamarin.iOS
Version: 6.3.5.43 (Business Edition)
Hash: 07cde46
Branch: 
Build date: 2013-13-05 14:44:13-0400

--

If I link sdk assemblies only or ALL assemblies, the app crashes.  We are using crashlytics so I'm including the info below, but it appears that something in the System.ServiceModel is not linking.  If I turn linking off then it works fine.  I've tried both LLVM and not, ARMV7 and ARMV7+ARMV7s, I've tried putting Preserve attributes on various classes associated to the stack with the problem, nothing I seem to do can resolve this.  Please investigate as I believe it's a linker issue.

Exception Type: System.NullReferenceException
Reason: Object reference not set to an instance of an object

<unknown> line 253
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_0

ClientBase.cs line 253
System_ServiceModel_MonoInternal_ClientRuntimeChannel__ctor_System_ServiceModel_Description_ServiceEndpoint_System_ServiceModel_ChannelFactory_System_ServiceModel_EndpointAddress_System_Uri

System_ServiceModel__System_ServiceModel_ClientBase_1_ChannelBase_1_get_Inner

System_ServiceModel__System_ServiceModel_ClientBase_1_ChannelBase_1_BeginInvoke_string_object___System_AsyncCallback_object

Thank you.
Comment 3 Miguel de Icaza [MSFT] 2013-05-27 06:25:42 UTC
This is a regression in the Async release.
Comment 4 Sebastien Pouliot 2013-05-27 07:59:27 UTC
Looks similar to #11893, will look into it.
Comment 5 Sebastien Pouliot 2013-05-27 09:09:26 UTC
$ git branch --contains b4fac5e9299462d8030a62c9177fb5bb17b0e6e7
* master-3.0

Looks like the fix for #11893 was committed just after then 6.3.5 branch.
Comment 6 Sebastien Pouliot 2013-05-27 09:45:01 UTC
Yes, it's a dupe. This will be fixed in the next beta release.

For an immediate workaround you can add the following to your app.

		// dummy field
		System.ServiceModel.Channels.IChannelFactory<object> factory;

		// inside your code, e.g. FinishedLoading
		if (factory != null) {
			factory.CreateChannel (null);
			factory.CreateChannel (null, null);
		}

That will ensure the linker keeps the CreateChannel (used thru reflection) inside your application. With those lines calling:

			WCF.GetAPDLService ().Open ();

works for me (and throw the NEW without).

*** This bug has been marked as a duplicate of bug 11893 ***
Comment 7 jonathan_chapman 2014-05-02 13:59:07 UTC
For some reason this issue happens for me after I upgraded to Android 4.12.2 from 4.12.1.  The suggested work around works so I've done this but it seems strange that after a year it's back.