Bug 36080 - [Mono 4.2] "'System.ServiceModel.EndpointAddress10' does not have a static method 'GetSchema' that takes a parameter of type 'System.Xml.Schema.XmlSchemaSet'" when using the Xamarin Mobile profile with some WCF client apps
Summary: [Mono 4.2] "'System.ServiceModel.EndpointAddress10' does not have a static me...
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies ()
Version: 4.2.0 (C6)
Hardware: PC Mac OS
: Normal normal
Target Milestone: C6SR4
Assignee: marcos.henrich
Depends on:
Reported: 2015-11-19 23:38 UTC by Cody Beyer (MSFT)
Modified: 2016-05-02 11:16 UTC (History)
8 users (show)

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

Patched System.ServiceModel.dll for Xamarin.Android on Windows (371.00 KB, application/x-msdownload)
2016-04-23 01:39 UTC, Brendan Zagaeski (Xamarin Team, assistant)

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 GitHub or Developer Community 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 Cody Beyer (MSFT) 2015-11-19 23:38:19 UTC
### Description

The follow exception is occurring within a WCF service after an upgrade to Mono 4.2

### Error


### Versions

=== Xamarin Studio ===

Version 5.10 (build 871)
Installation UUID: 75d8af3d-55ad-4008-acaa-d516dac5380a
	Mono 4.2.1 (explicit/6dd2d0d)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010102

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.1.1 (9081)
Build 7B1005

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/codybeyer/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		6.0   (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.0.1
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)

=== Xamarin Android Player ===

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

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 3c0ec35
Branch: master
Build date: 2015-11-12 13:05:39-0500

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 510000871
Git revision: 4e9c5abb5ffdae12ba02ac49da83f8b2011dbb88
Build date: 2015-11-12 06:02:54-05
Xamarin addins: 55007ed0e56436f385d8e26394a45be563abc7e8
Build lane: monodevelop-lion-cycle6

=== Operating System ===

Mac OS X 10.11.1
Darwin Codys-MacBook-Pro.local 15.0.0 Darwin Kernel Version 15.0.0
    Sat Sep 19 15:53:46 PDT 2015
    root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64
Comment 5 Brendan Zagaeski (Xamarin Team, assistant) 2016-01-11 01:12:35 UTC
It turns out this problem is similar to non-public Bug 37234, Comment 5: the problem only affects the Mobile profile of Mono.

I have attached a new test case in a private comment that includes a Xamarin.Mac project. This project allows switching easily between the Mobile profile and the full Desktop profile for testing.

## Regression status: regression in Cycle 6

> BAD:  Xamarin.Android  (50280e4), Xamarin.Mac   (304b193) ("Cycle 6 – Service Release 1")
> BAD:  Xamarin.Android (3efa14c), Xamarin.Mac (815e5d6) ("Cycle 6")
> GOOD: Xamarin.Android  (f7b9e87), Xamarin.Mac (6db87c5) ("Cycle 5 – Service Release 5")

## Steps to replicate

(In case it might be a helpful shortcut, steps 1 and 2 are not strictly required because the error happens _before_ the app attempts to connect to the service. Steps 1 and 2 are only needed if you wish to confirm that the app runs without error when using the Desktop profile or the old Cycle 5 versions.)

1. Run the WCF service from the "ServiceToRunOnWindows" folder in the test case in Windows. (I tested in VS 2013 Upate 5, using IIS Express, on Windows 10).

You can follow the steps on [1] to help make sure the WCF service is accessible over the local network for testing.
[1] https://developer.xamarin.com/guides/cross-platform/application_fundamentals/web_services/walkthrough_working_with_WCF/

2. Update the "EndPoint" field in the "MacApp1" test project to match the address of the running service from step 1.

3. Run the "MacApp1" test project in Xamarin Studio in the Debug configuration.

## Results for the Mobile profile with the new Xamarin.Mac app test case ("Bad")

The program prints the following error message to standard output (excerpt):

> Type 'System.ServiceModel.EndpointAddress10' does not have a static method 'GetSchema' that takes a parameter of type 'System.Xml.Schema.XmlSchemaSet' as specified by the XmlSchemaProviderAttribute attribute.
>   at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_delegate_end_invoke (object,intptr)
>   at (wrapper delegate-end-invoke) <Module>:end_invoke_object__this___object[]&_IAsyncResult (object[]&,System.IAsyncResult)
>   at System.ServiceModel.MonoInternal.ClientRuntimeChannel.EndProcess (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters, IAsyncResult result) [0x00025] in /Users/builder/data/lanes/2691/304b193b/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:460 

## Results for the "Unsupported Framework: Mono / .NET 4.5" with the new Xamarin.Mac app test case

The program prints the following message to standard output:

> Hello World to Xamarin.
Comment 8 marcos.henrich 2016-03-14 17:03:58 UTC
Should be fixed by PR https://github.com/mono/mono/pull/2760.

The pull is against mono 4.4.
Once the pull request is reviewed and merged I will cherry-pick the fix into master.
Comment 10 marcos.henrich 2016-03-30 07:46:09 UTC
Fixed in master 028a573cd28e1aa0a9270e45591e253f20d21d27.
Comment 11 marcos.henrich 2016-04-11 16:04:28 UTC
Fixed in mono-4.4.0-branch aea10b3386820d55caedfe41ab07342c3b9b0cc4
Comment 13 marcos.henrich 2016-04-18 07:46:35 UTC
Fixed in mono-4.2.0-branch 13f2557a3c550ab407fc5a5e038cf9f8331e90a1.
Comment 14 Brendan Zagaeski (Xamarin Team, assistant) 2016-04-23 01:38:11 UTC
The candidate fix for this issue has been applied to the development branch of "Cycle 6 – Service Release 3" in preparation for an additional "Service Release 4" bugfix release. "Service Release 4" will eventually be published to the Stable updater channel as usual, but due to the Evolve conference (https://evolve.xamarin.com) Xamarin is hosting next week, the release process is temporarily suspended until May 2.

To cover the interim, I will post some "preview" installer packages for "Service Release 4" that include the fix for this bug (Bug 36080).

One remaining complication is that by chance the corresponding Windows installer has not yet been built. This means that Android apps built on Windows will still hit the same bug. (In contrast, iOS apps built on Windows will be _fixed_ by the Mac Xamarin.iOS installer provided below due to the way that Visual Studio builds iOS apps.)

## Preview installer packages for Mac that include the fix

As for any other Xamarin preview packages, after installing these packages you will need to disregard any notifications from the IDE to update to a "newer" version of Xamarin until the completed "Cycle 6 – Service Release 4" release is published to the Stable updater channel.

### Xamarin.iOS installer


### Xamarin.Android installer


### Xamarin.Mac installer

Comment 15 Brendan Zagaeski (Xamarin Team, assistant) 2016-04-23 01:39:55 UTC
Created attachment 15823 [details]
Patched System.ServiceModel.dll for Xamarin.Android on Windows

## "Hack" to apply the fix to Xamarin.Android on Windows

If you're in a pinch with Xamarin.Android and would rather not build temporarily on Mac or wait for the formal Stable release of "Service Release 4", you can copy the single patched assembly for `System.ServiceModel.dll` into the frameworks folder on Windows:

1. Download the attached `System.ServiceModel.dll`.

If you prefer, you could instead copy the file from the following location on the Mac after you have installed the package from Comment 14: 


2. Copy the file into the following location on Windows, overwriting the existing file:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.ServiceModel.dll

3. This workaround will only be effective if you disable "Use Shared Runtime" under "Project Properties > Android Options > Packaging [tab]", so Release builds will work correctly by default but Debug builds will not.

* * *

If you _need_ to use the workaround with the Shared Runtime enabled, you could in theory copy the 6 shared runtime `.apk` files from the Mac [1] to overwrite the corresponding files on Windows [2], and then manually uninstall the old shared runtime from your test device under "Settings > Apps > Mono Shared Runtime". But at that point it might be simpler to wait for the formal "Cycle 6 – Service Release 4" Stable release.

[1] /Library/Frameworks/Xamarin.Android.framework/Versions/6.0.3-7/lib/mandroid/Mono.Android.DebugRuntime*.apk

[2] C:\Program Files (x86)\MSBuild\Xamarin\Android\Mono.Android.DebugRuntime*.apk