Bug 52595 - Linker SDK Only - Deserializing read-only members to ServiceModel.ExceptionDetail
Summary: Linker SDK Only - Deserializing read-only members to ServiceModel.ExceptionDe...
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: Linker ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Radek Doulik
URL:
Depends on:
Blocks:
 
Reported: 2017-02-17 08:08 UTC by jeromevelde
Modified: 2017-02-17 09:17 UTC (History)
1 user (show)

Tags: wcf android pcl service.model linker
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 ANSWERED

Description jeromevelde 2017-02-17 08:08:20 UTC
Hello,

First, sorry for my english 

Today, I'm front of an impossible problem...

I have an application in 2 parts :

1) Application in Xamarin Android 
2) PCL (I use a PCL because the app need to call a WebService in WCF)

In release, with Linker set to none, the app work like a charm but when I want to set the value to SDK Only (for reduce APK size). I got an error (See below)


Part of Stack trace :
System.Runtime.Serialization.InvalidDataContractException: Error on deserializing read-only members in the class: 
No set method for property 'Message' in type 'System.ServiceModel.ExceptionDetail'.
  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)

The error raise in the AsyncCompletedEventArgs of the PCL's call

I think, I need to create an "linkDescrption" file like that :

<?xml version="1.0" encoding="utf-8" ?>
<linker>
  <assembly fullname="System.ServiceModel">
    <type fullname="System.ServiceModel.ExceptionDetail" preserve="fields">
      <field name="Message" />
    </type>
  </assembly>
</linker>

But i don't know what I need to put in this file..

System information : 
VisualStudio : 2013
Xamarin Plugin : Last stable version 
JDK : 1.8.0_102
Android : 4.4 (Kit kat)

Can you help me ? If information is missing, tell me

Thanks in advance
Comment 1 jeromevelde 2017-02-17 09:16:48 UTC
I have found the solution !Finally, In csproj properties => Android Options => Linker, I have set linker to "SDK Assembly Only" and (just below) Skip linking assemblies to "System.ServiceModel" .