Bug 44989 - Overloaded System.ServiceModel.ChannelFactory.CreateChannel() not called in Release/Ad-Hoc Mode
Summary: Overloaded System.ServiceModel.ChannelFactory.CreateChannel() not called in R...
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 10.0 (iOS10)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2016-10-03 19:10 UTC by Ekki
Modified: 2017-06-13 16:09 UTC (History)
7 users (show)

Tags: ExPT, xamexttriage
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:

Description Ekki 2016-10-03 19:10:43 UTC
Below you see some code that is in use for ages. With Xamarin.iOS 10, however, it does not work anymore on Device in Release/Ad-Hoc Mode. Although the constructor is executed the overload CreateChannel() is NOT called, and it seems the base implementation is called instead, creating an exception: MonoTouch does not support dynamic proxy code generation. Override this method or its caller to return specific client proxy instance. Works in Debug mode on Device, always in Simulator.

Workaround: Downgrade to Xamarin.iOS


public class ChannelFactoryWithCredentials : System.ServiceModel.ChannelFactory<Contracts.ServiceContracts.IConfigurationService>
private ConfigurationServiceClient client;

            public ChannelFactoryWithCredentials (ConfigurationServiceClient client, System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress endpointAddress)
                : base(binding, endpointAddress)
                this.client = client;

            public override Diomex.XcalibuR.Configurator.Contracts.ServiceContracts.IConfigurationService CreateChannel (System.ServiceModel.EndpointAddress address, Uri via)
                this.client.ClientCredentials.UserName.UserName = this.Credentials.UserName.UserName;
                this.client.ClientCredentials.UserName.Password = this.Credentials.UserName.Password;

                return new ConfigurationServiceClientChannel(this.client);
Comment 1 Timothy Risi 2016-10-05 18:35:01 UTC

Could you provide the full stack trace for the exception and your environment information?

The easiest way to get exact version information is to use the "Xamarin Studio" menu, "About Xamarin Studio" item, "Show Details" button and copy/paste the version informations (you can use the "Copy Information" button).
Comment 2 Ekki 2016-10-05 18:41:12 UTC
Don't have a stack trace coz I cannot catch it. Happens only on Device in non-Debug mode.


=== Xamarin Studio Community ===

Version 6.1.1 (build 15)
Installation UUID: 84015b19-2768-4aa8-96cc-3bf1975b5714
	Mono 4.6.1 (mono-4.6.0-branch-c8sr0/abb06f1) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 406010003

=== NuGet ===


=== Xamarin.Profiler ===

Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.0 (11246)
Build 8A218a

=== Xamarin.Mac ===

Version: (Xamarin Studio Community)

=== Xamarin.Android ===

Version: (Xamarin Studio Community)
Android SDK: /Users/eb/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
		6.0   (API level 23)

SDK Tools Version: 25.1.2
SDK Platform Tools Version: 24.0.0
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Android Designer EPL code available here:

=== Xamarin Android Player ===

Version: 0.6.2
Location: /Applications/Xamarin Android Player.app

=== Xamarin.iOS ===

Version: (Xamarin Studio Community)
Hash: f37444a
Branch: cycle7-sr1
Build date: 2016-07-28 12:17:02-0400

=== Build Information ===

Release ID: 601010015
Git revision: fa52f02641726146e2589ed86ec4097fbe101888
Build date: 2016-09-22 08:03:02-04
Xamarin addins: 75d65712af93d54dc39ae4c42b21dfa574859fd6
Build lane: monodevelop-lion-cycle8-sr0

=== Operating System ===

Mac OS X 10.12.0
Darwin IG-MOBILE17.local 16.0.0 Darwin Kernel Version 16.0.0
    Mon Aug 29 17:56:20 PDT 2016
    root:xnu-3789.1.32~3/RELEASE_X86_64 x86_64
Comment 3 Ekki 2016-10-06 09:27:37 UTC
The environment information above describes the Working scenario. If I only update Xamarin.iOS to the next newer version, which is a 10.something, the error happens.
Comment 4 Ekki 2016-10-07 06:26:46 UTC
When exploring this issue I learned about a 'similar' issue in the context of Xamarin.Android. It had also todo with CreateChannel() but the problem was a little bit different so the work-around was. Maybe this kinda helps a little bit...
Comment 5 Ekki 2016-10-08 20:25:10 UTC
any news, guys? anything expected from my side?

Feel kinda bad if my Apps don't work with all the latest pckges from the Stable channel
Comment 6 Sebastien Pouliot 2016-10-11 12:29:02 UTC
from comment #2

> Version: (Xamarin Studio Community)

The question from @Tim was to know which version of XI caused the issue. But this seems, from your other comments, to be the version that works, right ?

Also the code above is not complete enough for us to double check your result. Could you attach a small, self contained, test so we can make investigate the issue ? thanks!
Comment 7 Ekki 2016-10-19 06:53:24 UTC
the issue happened after updating to the latest Xamarin components of the stable branch. As workaround I can solve it by downgrading Xamarin.iOS to the latest official Pre-10 version.

#1 Minimal test case - this is what I did request from the partner that provides the assembly that is playing with those Channel Factories. He said it will take him 2 days to put the minimal test case together and he's too busy these days.

#2 access to Repos - I can give you access to 5 bitbucket repos. All you need to do is to clone them side-by-side and call a setup.sh once. Then you would be able to reproduce the issue and probably fix it, as I believe it has to do with linking and building, not with compiling. Remember, it only happens in Release mode, not in Debug mode. Very similar to that Xamarin.Android issue I mentioned above.

#3 Minimal test case 2 - for someone on your side, who's familiar with those Channel Factories - I'm not, it's probably an easy thing to setup something with an own Channel Factory and simply overloaded CreateChannel(). I do believe that this scenario should generate the same error behavior.

so how to continue?
Comment 8 Sebastien Pouliot 2016-12-05 21:55:38 UTC
@Ekki, please provide us a self contained test case that allow us (non channel experts) to reproduce the issue. Ideally open #1 (fast) or email me details for #2 (slow).
Comment 9 Ekki 2016-12-06 12:17:55 UTC
Will turn myself into a Channel Expert, well kinda, and compile something. Pls give me one week...
Comment 10 Manuel de la Peña [MSFT] 2017-01-03 09:52:01 UTC
@Ekki have you managed to create the test case that @Sebastien requested?
Comment 11 Ekki 2017-01-03 10:07:53 UTC
Tried to but some unforeseeable issues in other projects didn't allow me to do so. Will give it a new try this weekend
Comment 12 Manuel de la Peña [MSFT] 2017-01-09 10:24:10 UTC

Have you had the time to take a look at this?
Comment 13 Ekki 2017-01-09 10:28:03 UTC
started but some 3D issues troubled me, right before the big fair... it turned out that this was caused by iOS 8.x that is limited in the Metal implementation... damned... upgrade to iOS 9.3.5 solved it...
Comment 14 Timothy Risi 2017-02-22 20:20:28 UTC

Ever have any luck getting a test case for us to reproduce this?  Or did you mean the upgrade to iOS 9.3.5 fixed the original issue?
Comment 15 Ekki 2017-02-23 09:18:15 UTC
believe it or not, right yesterday I spoke again with the guy who did write the ChannelFactory module again to ask for a minimal test case. Hope we can solve this now coz I stuck with the latest Xamarin.iOS 9.x release and I feel really bad if out of sync with the stable channel. 

The 9.3.5 comment above was on the context of that specific 3D problem, nothing to do with the channel factory.
Comment 16 Alex Soto [MSFT] 2017-03-26 15:48:56 UTC
We have not received the requested information. If you are still 
experiencing this issue please provide all the requested information 
and re-open the bug report. Thanks!