This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
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...
Status: VERIFIED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF (show other bugs)
Version: 4.2.0 (C6)
Hardware: PC Mac OS
: Normal normal
Target Milestone: C6SR4
Assignee: marcos.henrich
URL:
Depends on:
Blocks:
 
Reported: 2015-11-19 23:38 UTC by Cody Beyer (MSFT)
Modified: 2016-05-02 11:16 UTC (History)
8 users (show)

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


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

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

https://gist.github.com/CodyBeyer/cca7b62860c951d93d87

### Versions

=== Xamarin Studio ===

Version 5.10 (build 871)
Installation UUID: 75d8af3d-55ad-4008-acaa-d516dac5380a
Runtime:
	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: 6.0.0.34 (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: 9.2.1.51 (Business Edition)
Hash: 3c0ec35
Branch: master
Build date: 2015-11-12 13:05:39-0500

=== Xamarin.Mac ===

Version: 2.4.0.109 (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 Support) 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 6.0.1.5  (50280e4), Xamarin.Mac 2.4.1.5   (304b193) ("Cycle 6 – Service Release 1")
> BAD:  Xamarin.Android 6.0.0.34 (3efa14c), Xamarin.Mac 2.4.0.109 (815e5d6) ("Cycle 6")
> GOOD: Xamarin.Android 5.1.9.0  (f7b9e87), Xamarin.Mac 2.0.2.111 (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.
https://github.com/mono/mono/commit/028a573cd28e1aa0a9270e45591e253f20d21d27
Comment 11 marcos.henrich 2016-04-11 16:04:28 UTC
Fixed in mono-4.4.0-branch aea10b3386820d55caedfe41ab07342c3b9b0cc4
https://github.com/mono/mono/commit/aea10b3386820d55caedfe41ab07342c3b9b0cc4
Comment 13 marcos.henrich 2016-04-18 07:46:35 UTC
Fixed in mono-4.2.0-branch 13f2557a3c550ab407fc5a5e038cf9f8331e90a1.
https://github.com/mono/mono/commit/13f2557a3c550ab407fc5a5e038cf9f8331e90a1
Comment 14 Brendan Zagaeski (Xamarin Support) 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

http://download.xamarin.com/c6sr4-preview/xamarin.ios-9.6.2.1.pkg


### Xamarin.Android installer

http://download.xamarin.com/c6sr4-preview/xamarin.android-6.0.3-7.pkg


### Xamarin.Mac installer

http://download.xamarin.com/c6sr4-preview/xamarin.mac-2.4.2.2.pkg
Comment 15 Brendan Zagaeski (Xamarin Support) 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: 

/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild-frameworks/MonoAndroid/v1.0/System.ServiceModel.dll



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

Note You need to log in before you can comment on or make changes to this bug.