Bug 26998

Summary: Issue with DataContractJsonSerializer - Deserialize type incorrect on iOS
Product: [Mono] Class Libraries Reporter: Anubhav Ranjan <anubhav>
Component: WCF assembliesAssignee: Bugzilla <bugzilla>
Status: RESOLVED FIXED    
Severity: normal CC: carlowahlstedt, lexas, mono-bugs+mono, paninee, pauldivaniii, rolf, samir.pathak, sebastien
Priority: ---    
Version: 3.12.0   
Target Milestone: Untriaged   
Hardware: Macintosh   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: Sample Project as sent by the Customer
Fix System.Runtime.Serialization.dll
Fixed System.Runtime.Serialization.dll (4.5 profile)
System.Runtime.Serialization.dll.mdb

Description Anubhav Ranjan 2015-02-12 12:11:48 UTC
Created attachment 9796 [details]
Sample Project as sent by the Customer

###Customer Description:

I have a customer project that is using the .Net JSON Deserializer and the
project will run successfully in Windows but not in OS X. If I remove
"abstract" from the BaseType class, then the error disappears.

I think the error was introduced in the 3.12.0 version of the Mono framework.

More specifically, I think the “Implement KnownTypes for DataContractJsonSerializer<https://github.com/mono/website/blob/gh-pages/docs/about-mono/releases/3.12.0.md>;” on the release from bug 23058<https://bugzilla.xamarin.com/show_bug.cgi?id=23058>; is where the issue was introduced.



The error I get reads:

System.Runtime.Serialization.SerializationException: Cannot load type 'KnownDerivedType:#PolymorphismJsonDeserializationConsole'. Error at (1,92)
at System.Runtime.Serialization.Json.JsonSerializationReader.ReadInstanceDrivenObject () [0x00075] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.0/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:243
at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x0048f] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.0/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:200
at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.0/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72
at System.Runtime.Serialization.Json.JsonSerializationReader.DeserializeGenericCollection (System.Type collectionType, System.Type elementType, System.Object collectionInstance) [0x00247] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.0/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:355
at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00419] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.0/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:183
at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.0/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72
at System.Runtime.Serialization.Json.TypeMapProperty.SetMemberValue (System.Object owner, System.Runtime.Serialization.Json.JsonSerializationReader jsr) [0x00019] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.0/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:361
at System.Runtime.Serialization.Json.TypeMap.Deserialize (System.Runtime.Serialization.Json.JsonSerializationReader jsr, System.Object o) [0x000f4] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.0/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:263
at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00485] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.0/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:195
at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.0/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72
at System.Runtime.Serialization.Json.JsonSerializationReader.ReadRoot () [0x0000d] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.0/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:66
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject (System.Xml.XmlReader reader, Boolean verifyObjectName) [0x00045] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.0/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/DataContractJsonSerializer.cs:202
Comment 1 Anubhav Ranjan 2015-02-12 12:12:44 UTC
As a reminder from the original email, part of my discovery with this project I created was that:

* This project runs successfully in Windows but not in OS X.
* If you make the BaseType a concrete class then the error goes away.



Xamarin Studio
Version 5.7 (build 661)
Installation UUID: 61d90e17-64df-468a-b277-a11118fa99f7
Runtime:
Mono 3.12.0 ((detached/a813491)
GTK+ 2.24.23 (Raleigh theme)

Package version: 312000068

Apple Developer Tools
Xcode 6.1.1 (6611)
Build 6A2008a

Xamarin.iOS
Version: 8.6.0.51 (Business Edition)
Hash: dfb682f
Branch:
Build date: 2015-01-08 13:39:32-0500

Xamarin.Android
Version: 4.20.0.28 (Trial Edition)
Android SDK: /Users/carlo.wahlstedt/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
2.1 (API level 7)
2.2 (API level 8)
2.3 (API level 10)
3.1 (API level 12)
4.0.3 (API level 15)
4.4 (API level 19)
4.4.87 (API level 20)
5.0 (API level 21)
Java SDK: /usr
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

Xamarin.Mac
Not Installed

Build Information
Release ID: 507000661
Git revision: b70bab61da996da29045ea8ee8aed1a6faedbe78
Build date: 2015-01-05 16:31:31-05
Xamarin addins: 82f6c71490562d6cd125a09287f441902fdac3d7

Operating System
Mac OS X 10.10.2
Darwin Carlos-MacBook-Pro.local 14.1.0 Darwin Kernel Version 14.1.0
Mon Dec 22 23:10:38 PST 2014
root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64
Comment 3 Sebastien Pouliot 2015-03-09 20:57:32 UTC
Created attachment 10236 [details]
Fix System.Runtime.Serialization.dll

To use the attached assembly (on top of Xamarin.iOS 8.6.x) do:

1) Backup those files

/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/System.Runtime.Serialization.dll
and
/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/System.Runtime.Serialization.dll.mdb


2) Extract attached archive content into 

/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/


3) Clean, rebuild and test your application


Please let us know if this fixed your issue. Thanks!
Comment 4 Carlo Wahlstedt 2015-03-09 23:37:08 UTC
StackTrace:

System.Runtime.Serialization.SerializationException: Cannot load type 'KnownDerivedType:#PolymorphismJsonDeserializationConsole'. Error at  (1,92)
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadInstanceDrivenObject () [0x00075] in /private/tmp/source-mono-mac-3.12.99-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:243 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x0048f] in /private/tmp/source-mono-mac-3.12.99-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:200 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /private/tmp/source-mono-mac-3.12.99-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72 
  at System.Runtime.Serialization.Json.JsonSerializationReader.DeserializeGenericCollection (System.Type collectionType, System.Type elementType, System.Object collectionInstance) [0x00247] in /private/tmp/source-mono-mac-3.12.99-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:355 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00419] in /private/tmp/source-mono-mac-3.12.99-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:183 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /private/tmp/source-mono-mac-3.12.99-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72 
  at System.Runtime.Serialization.Json.TypeMapProperty.SetMemberValue (System.Object owner, System.Runtime.Serialization.Json.JsonSerializationReader jsr) [0x00019] in /private/tmp/source-mono-mac-3.12.99-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:361 
  at System.Runtime.Serialization.Json.TypeMap.Deserialize (System.Runtime.Serialization.Json.JsonSerializationReader jsr, System.Object o) [0x000f4] in /private/tmp/source-mono-mac-3.12.99-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:263 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00485] in /private/tmp/source-mono-mac-3.12.99-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:195 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /private/tmp/source-mono-mac-3.12.99-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadRoot () [0x0000d] in /private/tmp/source-mono-mac-3.12.99-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:66 
  at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject (System.Xml.XmlReader reader, Boolean verifyObjectName) [0x00045] in /private/tmp/source-mono-mac-3.12.99-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/DataContractJsonSerializer.cs:202 

------------------------------
Application Output:

Loaded assembly: /Users/carlo.wahlstedt/Projects/PolymorphismJsonDeserializationConsole/PolymorphismJsonDeserializationConsole/bin/Debug/PolymorphismJsonDeserializationConsole.exe
Loaded assembly: /Library/Frameworks/Mono.framework/Versions/3.12.1/lib/mono/gac/System.Runtime.Serialization/4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
Loaded assembly: /Library/Frameworks/Mono.framework/Versions/3.12.1/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089/System.Xml.dll
Loaded assembly: /Library/Frameworks/Mono.framework/Versions/3.12.1/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll

------------------------------
=== Xamarin Studio ===

Version 5.7.2 (build 7)
Installation UUID: 61d90e17-64df-468a-b277-a11118fa99f7
Runtime:
	Mono 3.12.1 ((detached/b7764aa)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312010000

=== Apple Developer Tools ===

Xcode 6.1.1 (6611)
Build 6A2008a

=== Xamarin.iOS ===

Version: 8.6.3.3 (Business Edition)
Hash: 90e32d0
Branch: 
Build date: 2015-03-06 12:27:17-0500

=== Xamarin.Android ===

Version: 4.20.0.37 (Business Edition)
Android SDK: /Users/carlo.wahlstedt/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		4.0.3  (API level 15)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

=== Xamarin.Mac ===

Not Installed

=== Build Information ===

Release ID: 507020007
Git revision: dcf3f486177d3e625349b51a8f3be807e3fa7712
Build date: 2015-02-24 09:14:27-05
Xamarin addins: ea7c65bb7876e4a876ab365208e94acdf8f330ef

=== Operating System ===

Mac OS X 10.10.2
Darwin carlo-macbkpro 14.1.0 Darwin Kernel Version 14.1.0
    Mon Dec 22 23:10:38 PST 2014
    root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64
Comment 5 Carlo Wahlstedt 2015-03-10 08:29:53 UTC
Missed my comments. It looks like I'm getting the same error. I replaced the files you mentioned using the command line:

sudo cp ~/Downloads/Archive/System.Runtime.Serialization.dll.mdb System.Runtime.Serialization.dll.mdb

sudo cp ~/Downloads/Archive/System.Runtime.Serialization.dll System.Runtime.Serialization.dll

I did a clean, rebuild and ran the application. I even restarted Xamarin Studio and restarted my mac just in case.

I also verified that they had been updated. Am I missing something?
Comment 6 Alexis Christoforides 2015-03-10 21:40:52 UTC
Created attachment 10263 [details]
Fixed System.Runtime.Serialization.dll (4.5 profile)

Hello! I have confirmed that the fix works for the sample, and the SerializationException returns when I revert it. 

I noticed that the assemblies that Sebastien provided were for the 2.0 profile while the sample project targets 4.5. 

I've attached a fixed 4.5 assembly. Could you please go through these similar steps with this file, to replace the copy mentioned in your application output?

--

sudo rm /Library/Frameworks/Mono.framework/Versions/3.12.1/lib/mono/gac/System.Runtime.Serialization/4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll 

sudo cp ~/download_dir/System.Runtime.Serialization.dll  /Library/Frameworks/Mono.framework/Versions/3.12.1/lib/mono/gac/System.Runtime.Serialization/4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
Comment 7 Carlo Wahlstedt 2015-03-11 12:50:11 UTC
I replaced the dll, but there was no .mdb file. I'm now getting this error and I'm assuming because of the .mdb file:

Symbol file /Library/Frameworks/Mono.framework/Versions/3.12.1/lib/mono/gac/System.Runtime.Serialization/4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll.mdb doesn't match image /Library/Frameworks/Mono.framework/Versions/3.12.1/lib/mono/gac/System.Runtime.Serialization/4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
PolymorphismJsonDeserializationConsole.ParentType
Comment 8 Alexis Christoforides 2015-03-11 14:47:35 UTC
Created attachment 10277 [details]
System.Runtime.Serialization.dll.mdb

Hi Carlo, 

I'm sorry, it is - I'm providing attaching the .mdb.

On the plus side, the last line is the actual successful output, so it worked :)
Comment 9 Carlo Wahlstedt 2015-03-11 15:15:25 UTC
Success!!
Comment 10 Pan K. 2015-03-19 01:34:13 UTC
I'm having a similar problem. This doesn't fix it for me. May be it's because I'm running on a simulator? Any idea?


======================================================================================================

System.Runtime.Serialization.SerializationException: Cannot load type 'StoreObj:#com.panik.discard'. Error at  (1,301)
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00455] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.8.1.9/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:190
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.8.1.9/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72
  at System.Runtime.Serialization.Json.TypeMapProperty.SetMemberValue (System.Object owner, System.Runtime.Serialization.Json.JsonSerializationReader jsr) [0x00019] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.8.1.9/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:361
  at System.Runtime.Serialization.Json.TypeMap.Deserialize (System.Runtime.Serialization.Json.JsonSerializationReader jsr, System.Object o) [0x000f4] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.8.1.9/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:263
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00472] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.8.1.9/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:192
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.8.1.9/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72
  at System.Runtime.Serialization.Json.JsonSerializationReader.DeserializeGenericCollection (System.Type collectionType, System.Type elementType, System.Object collectionInstance) [0x00256] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.8.1.9/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:355
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00419] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.8.1.9/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:183
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.8.1.9/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72
  at System.Runtime.Serialization.Json.TypeMapProperty.SetMemberValue (System.Object owner, System.Runtime.Serialization.Json.JsonSerializationReader jsr) [0x00019] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.8.1.9/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:361
  at System.Runtime.Serialization.Json.TypeMap.Deserialize (System.Runtime.Serialization.Json.JsonSerializationReader jsr, System.Object o) [0x000f4] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.8.1.9/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:263
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00485] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.8.1.9/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:195
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.8.1.9/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadRoot () [0x0000d] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.8.1.9/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:66
  at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject (System.Xml.XmlReader reader, Boolean verifyObjectName) [0x00045] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.8.1.9/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/DataContractJsonSerializer.cs:202

======================================================================================================

>Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/Xamarin.iOS.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/DiscardCustomerApp.iOS.exe
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/Xamarin.Forms.Platform.iOS.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/Xamarin.Forms.Core.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Runtime.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.ObjectModel.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/Xamarin.Auth.iOS.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Runtime.Serialization.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Xml.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Core.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/Mono.Dynamic.Interpreter.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.ComponentModel.Composition.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.IO.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Collections.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Threading.Tasks.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Globalization.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.ComponentModel.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Linq.Expressions.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Xml.ReaderWriter.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Reflection.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Dynamic.Runtime.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Threading.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Runtime.Extensions.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Linq.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Reflection.Extensions.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Diagnostics.Debug.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Net.Http.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Json.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/Xamarin.Forms.Xaml.dll [External]
Loaded assembly: /Users/jongrakjongcharoensiri/Library/Developer/CoreSimulator/Devices/0B2EFED5-4844-41D8-82E5-176214F3079A/data/Containers/Bundle/Application/68654500-EBFC-45E4-BF5A-CE8DC94C5D73/DiscardCustomerApp.iOS.app/System.Text.RegularExpressions.dll [External]


======================================================================================================

=== Xamarin Studio ===

Version 5.8 (build 443)
Installation UUID: 05aa03b2-562c-4d71-bf07-9c2167fd52a4
Runtime:
	Mono 3.12.1 ((detached/b7764aa)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312010000

=== Apple Developer Tools ===

Xcode 6.1.1 (6611)
Build 6A2008a

=== Xamarin.Mac ===

Not Installed

=== Xamarin.Android ===

Version: 4.20.0.37 (Trial Edition)
Android SDK: /Users/jongrakjongcharoensiri/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0.3 (API level 15)
		4.4   (API level 19)
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 ===

Not Installed

=== Xamarin.iOS ===

Version: 8.8.0.2 (Trial Edition)
Hash: ccfcd59
Branch: 
Build date: 2015-03-10 02:20:32-0400

=== Build Information ===

Release ID: 508000443
Git revision: 73883239470cbe8e261c94d95f7c3d0452fd393b
Build date: 2015-03-10 07:22:51-04
Xamarin addins: a2ff7b617f09d9c45d8bbf3d010b5db0d7d36100

=== Operating System ===

Mac OS X 10.10.2
Darwin Jongraks-MacBook-Air.local 14.1.0 Darwin Kernel Version 14.1.0
    Mon Dec 22 23:10:38 PST 2014
    root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64

======================================================================================================
Comment 11 Pan K. 2015-03-20 00:52:46 UTC
To follow up on my last comment, I put the files in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/. When I compile , I got an error saying "'/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.Runtime.Serialization.dll' does not contain valid metadata (CS0009)"
Comment 12 Samir Pathak 2015-03-24 18:38:15 UTC
hi guys - heard back from my customer who said the following.  please let me know if there's additional information that's needed.

-----

Just double checked this. It’s still failing and based on the error I’m going to assume there’s another System.Runtime.Serialization.dll that exists specifically for the MonoTouch framework. 


Here’s the stack trace:

System.Runtime.Serialization.SerializationException: Cannot load type 'CIFDDARelatedAccountV1:#CSI.NuPoint.CIF'. Error at  (1,93)
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00455] in /Developer/MonoTouch/Source/monotouch/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:190 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /Developer/MonoTouch/Source/monotouch/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72 
  at System.Runtime.Serialization.Json.TypeMapProperty.SetMemberValue (System.Object owner, System.Runtime.Serialization.Json.JsonSerializationReader jsr) [0x00019] in /Developer/MonoTouch/Source/monotouch/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:361 
  at System.Runtime.Serialization.Json.TypeMap.Deserialize (System.Runtime.Serialization.Json.JsonSerializationReader jsr, System.Object o) [0x000f4] in /Developer/MonoTouch/Source/monotouch/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:263 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00472] in /Developer/MonoTouch/Source/monotouch/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:192 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /Developer/MonoTouch/Source/monotouch/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72 
  at System.Runtime.Serialization.Json.JsonSerializationReader.DeserializeGenericCollection (System.Type collectionType, System.Type elementType, System.Object collectionInstance) [0x0022d] in /Developer/MonoTouch/Source/monotouch/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:354 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00419] in /Developer/MonoTouch/Source/monotouch/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:183 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /Developer/MonoTouch/Source/monotouch/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72 
  at System.Runtime.Serialization.Json.TypeMapProperty.SetMemberValue (System.Object owner, System.Runtime.Serialization.Json.JsonSerializationReader jsr) [0x00019] in /Developer/MonoTouch/Source/monotouch/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:361 
  at System.Runtime.Serialization.Json.TypeMap.Deserialize (System.Runtime.Serialization.Json.JsonSerializationReader jsr, System.Object o) [0x000f4] in /Developer/MonoTouch/Source/monotouch/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:263 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00485] in /Developer/MonoTouch/Source/monotouch/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:195 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /Developer/MonoTouch/Source/monotouch/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadRoot () [0x0000d] in /Developer/MonoTouch/Source/monotouch/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:66 
  at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject (System.Xml.XmlReader reader, Boolean verifyObjectName) [0x00045] in /Developer/MonoTouch/Source/monotouch/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/DataContractJsonSerializer.cs:202
Comment 13 Sebastien Pouliot 2015-03-24 19:57:39 UTC
@Carlo, the assemblies I originally provided where for Xamarin.iOS (not the desktop Mono). If you tested them with the desktop version of Mono then it would not work (wrong profile and wrong location).
Comment 14 Carlo Wahlstedt 2015-03-25 07:12:46 UTC
@Sebastien Originally I attempted to use the assemblies you provided to validate my test console application. However, once I got the new assemblies (for 4.0) and validated that my test console was working, I replaced the assemblies you provided for 2.0. I then attempted to run my Xamarin.iOS application but am still having issues.

However, I hear you saying that after following your original instructions, you would have expected it to work in my Xamarin.iOS application? 

To be clear, here are the commands I ran to replace the assemblies:

cd /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/

sudo cp ~/Downloads/System.Runtime.Serialization/2.0/System.Runtime.Serialization.dll System.Runtime.Serialization.dll

sudo cp ~/Downloads/System.Runtime.Serialization/2.0/System.Runtime.Serialization.dll.mdb System.Runtime.Serialization.dll.mdb

I'm not sure what else I could be doing wrong.
Comment 15 Sebastien Pouliot 2015-03-25 09:20:01 UTC
> Originally I attempted to use the assemblies you provided to validate my test console application.

That would not work, desktop mono and Xamarin.iOS uses different profiles/version and file locations.

> However, once I got the new assemblies (for 4.0) and validated that my test console was working,

Yes, right profile/location for a desktop (not iOS) application.

> following your original instructions you 
> would have expected it to work in my Xamarin.iOS application? 

Yes.

> ~/Downloads/System.Runtime.Serialization/2.0/

^ is that where you extracted the files I zipped ? because the directory structure does not match the one from the archive I supplied.

What does the following command return ?

> shasum /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/System.Runtime.Serialization.dll*
Comment 16 Carlo Wahlstedt 2015-03-25 09:24:14 UTC
Yes, that is the location where I extracted the assemblies. I placed them there because I was given a new set of dlls which worked for the 4.0 framework (desktop). So, I was trying to keep them in order.

Here's the command and output:

carlo-macbkpro:~ carlo.wahlstedt$ shasum /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/System.Runtime.Serialization.dll*
8b6d1eae23d899eadcbd457e54b53e845e802f85  /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/System.Runtime.Serialization.dll
12be3661750498455e77608fe7d13d7657600105  /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/System.Runtime.Serialization.dll.mdb
Comment 17 Sebastien Pouliot 2015-03-25 09:34:23 UTC
@Carlo, That's the right shasum for the file. There might have been more change that I was given.

@Alexis any reason why this bug was not closed/commented/... after you committed your fix ?

Also can you give the list of commit that constitute the fix (the one I got from Adrian might not be complete) ?
Comment 18 Sebastien Pouliot 2015-03-25 10:44:38 UTC
So I converted the desktop test case into a unit test for Xamarin.iOS and rebuilt with Alexis fix (mono/master 279d39dd7c9cac5bc836b2a795e5fad0977ed4f1) applied.

This is what I get:

2015-03-25 10:23:52.351 linkall[19730:8282152] 	[FAIL] Bug23058 : System.Runtime.Serialization.SerializationException : Cannot load type 'KnownDerivedType:#PolymorphismJsonDeserializationConsole'. Error at  (1,92)

So something else must be missing...
Comment 19 Alexis Christoforides 2015-04-22 16:22:52 UTC
@Sebastien, sorry for missing your reply.

The fix is actually just mono/master@22d5581e87ca4dc82412528cda5a77c53355973a. The hash in your comment does not seem to be valid.

I will close the bug, feel free to reopen if the fix still does not apply.
Comment 20 Sebastien Pouliot 2015-04-23 14:31:12 UTC
@Alexis, sorry I copy/pasted the wrong hash in my last comment. (probably me maccore instead of mono commit)

> lexas has a fix: https://github.com/mono/mono/commit/22d5581e87ca4dc82412528cda5a77c53355973a

^ that's what Adrian gave me and it did not work when backported. 

I thought other commits could be missing but it seems the (same) exception can be thrown from different sites, e.g.

mono 3.12
------------
> System.Runtime.Serialization.SerializationException: Cannot load type 'KnownDerivedType:#PolymorphismJsonDeserializationConsole'. Error at  (1,92)
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadInstanceDrivenObject () [0x00075] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:243 
>   at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x0048f] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:200 
>   at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72 
>   at System.Runtime.Serialization.Json.JsonSerializationReader.DeserializeGenericCollection (System.Type collectionType, System.Type elementType, System.Object collectionInstance) [0x00247] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:355 
>   at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00419] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:183 
>   at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72 
>   at System.Runtime.Serialization.Json.TypeMapProperty.SetMemberValue (System.Object owner, System.Runtime.Serialization.Json.JsonSerializationReader jsr) [0x00019] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:361 
>   at System.Runtime.Serialization.Json.TypeMap.Deserialize (System.Runtime.Serialization.Json.JsonSerializationReader jsr, System.Object o) [0x000f4] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:263 
>   at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00485] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:195 
>   at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72 
>   at System.Runtime.Serialization.Json.JsonSerializationReader.ReadRoot () [0x0000d] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:66 
>   at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject (System.Xml.XmlReader reader, Boolean verifyObjectName) [0x00045] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/DataContractJsonSerializer.cs:202 


XI (using mono/master, i.e. with your patch applied)
-----------------------------------------------------------

> 2015-04-23 14:23:51.452 linkall[89940:67853989] 	[FAIL] Bug26998 : System.Runtime.Serialization.SerializationException : Cannot load type 'KnownDerivedType:#PolymorphismJsonDeserializationConsole'. Error at  (1,92)
> 2015-04-23 14:23:51.452 linkall[89940:67853989] 		  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00455] in /Users/poupou/git/xamarin/maccore/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:190 
> 2015-04-23 14:23:51.453 linkall[89940:67853989] 		  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /Users/poupou/git/xamarin/maccore/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72 
> 2015-04-23 14:23:51.453 linkall[89940:67853989] 		  at System.Runtime.Serialization.Json.JsonSerializationReader.DeserializeGenericCollection (System.Type collectionType, System.Type elementType, System.Object collectionInstance) [0x0022d] in /Users/poupou/git/xamarin/maccore/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:356 
> 2015-04-23 14:23:51.453 linkall[89940:67853989] 		  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00419] in /Users/poupou/git/xamarin/maccore/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:183 
> 2015-04-23 14:23:51.453 linkall[89940:67853989] 		  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /Users/poupou/git/xamarin/maccore/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72 
> 2015-04-23 14:23:51.453 linkall[89940:67853989] 		  at System.Runtime.Serialization.Json.TypeMapProperty.SetMemberValue (System.Object owner, System.Runtime.Serialization.Json.JsonSerializationReader jsr) [0x00019] in /Users/poupou/git/xamarin/maccore/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:361 
> 2015-04-23 14:23:51.453 linkall[89940:67853989] 		  at System.Runtime.Serialization.Json.TypeMap.Deserialize (System.Runtime.Serialization.Json.JsonSerializationReader jsr, System.Object o) [0x000f4] in /Users/poupou/git/xamarin/maccore/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:263 
> 2015-04-23 14:23:51.454 linkall[89940:67853989] 		  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00485] in /Users/poupou/git/xamarin/maccore/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:195 
> 2015-04-23 14:23:51.454 linkall[89940:67853989] 		  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /Users/poupou/git/xamarin/maccore/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72 
> 2015-04-23 14:23:51.454 linkall[89940:67853989] 		  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadRoot () [0x0000d] in /Users/poupou/git/xamarin/maccore/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:66 
> 2015-04-23 14:23:51.454 linkall[89940:67853989] 		  at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject (System.Xml.XmlReader reader, Boolean verifyObjectName) [0x00045] in /Users/poupou/git/xamarin/maccore/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/DataContractJsonSerializer.cs:200
Comment 21 Sebastien Pouliot 2015-04-23 14:43:17 UTC
k, I found out the difference for comment #18/20 (namespace within test app).

However it does not explain why the first attachment did not work :| as it was the same commit (22d5581e87ca4dc82412528cda5a77c53355973a) applied to the mono used by XI.
Comment 22 Alexis Christoforides 2015-04-27 14:26:26 UTC
@Sebastien, as I understand it, Carlo was testing against desktop Mono at the beginning, so it only worked when he replaced the assembly at the path I provided. Is this what you mean? I don't know how to reproduce any issues when the fix is applied.
Comment 23 Samir Pathak 2015-04-30 12:45:39 UTC
@sebastien @alexis - sent a build to the customer with a backport of Mono 4.0 which was supposed to fix it, but when installing still came across this:

*****
Samir,

Thanks for the package, I was very excited to try it but very quickly found:

I installed the pkg but it looks like I’m still getting the same error and the version number is matching the version of the pkg:

2015-04-30 09:53:52.662 CSIXamarinContainer[1332:14575] System.Runtime.Serialization.SerializationException: Cannot load type 'CIFDDARelatedAccountV1:#CSI.NuPoint.CIF'. Error at  (1,93)
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00455] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.1.2/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:190 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.1.2/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72 
  at System.Runtime.Serialization.Json.TypeMapProperty.SetMemberValue (System.Object owner, System.Runtime.Serialization.Json.JsonSerializationReader jsr) [0x00019] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.1.2/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:361 
  at System.Runtime.Serialization.Json.TypeMap.Deserialize (System.Runtime.Serialization.Json.JsonSerializationReader jsr, System.Object o) [0x000f4] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.1.2/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:263 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00472] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.1.2/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:192 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.1.2/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72 
  at System.Runtime.Serialization.Json.JsonSerializationReader.DeserializeGenericCollection (System.Type collectionType, System.Type elementType, System.Object collectionInstance) [0x0022d] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.1.2/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:356 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00419] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.1.2/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:183 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.1.2/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72 
  at System.Runtime.Serialization.Json.TypeMapProperty.SetMemberValue (System.Object owner, System.Runtime.Serialization.Json.JsonSerializationReader jsr) [0x00019] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.1.2/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:361 
  at System.Runtime.Serialization.Json.TypeMap.Deserialize (System.Runtime.Serialization.Json.JsonSerializationReader jsr, System.Object o) [0x000f4] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.1.2/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:263 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00485] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.1.2/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:195 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.1.2/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72 
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadRoot () [0x0000d] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.1.2/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:66 
  at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject (System.Xml.XmlReader reader, Boolean verifyObjectName) [0x00045] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.1.2/src/mono/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/DataContractJsonSerializer.cs:200 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Users/Alex/monotouch/master/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/Alex/monotouch/master/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:201 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/Alex/monotouch/master/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/Alex/monotouch/master/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142 
  at System.Runtime.CompilerServices.TaskAwaiter`1[CSI.NuPoint.CIF.CIFRelatedAccountsV1].GetResult () [0x00000] in /Users/Alex/monotouch/master/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:372 
  at CSI.Xamarin.Empire.Customer.CustomerCollectionViewModel+<GetRelatedAccounts>c__async1.MoveNext () [0x00083] in /Users/carlo.wahlstedt/TfsSource/Research_and_Design/Client_iOS/Development/CSI.Xamarin.Empire.Customer/CSI.Xamarin.Empire.Customer/ViewModels/CustomerCollectionViewModel.cs:120
Comment 24 Rolf Bjarne Kvinge [MSFT] 2015-04-30 13:12:01 UTC
I've tested the original test case in Xamarin.iOS 8.10.1.5, and it works just fine.