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.
Created attachment 14222 [details] A solution containing WP8, iOS and Android projects as well as portable library demonstrating the issue I have a portable class library project that contains the following code: I have defined an object (AnnotationPlacement) which contains a sequence of objects that are either class A (Annotation) or class B (StampPlacement). Now I try to serialize an AnnotationPlacement which contains a subclass of B (DecisionStampPlacement). This works fine on Windows Phone, but the XmlSerializer throws an exception on iOS and Android. Expected behavior: no exception is thrown, XML can be generated (as on Windows Phone). My system is (all available updates are installed): Xamarin Studio Version 5.10.1 (build 6) Installation UUID: cd5de8aa-e5ec-4753-adb8-94cd3953973a 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.2 (9548) Build 7C68 Xamarin.iOS Version: 9.2.1.54 (Enterprise Edition) Hash: eb4c1ef Branch: master Build date: 2015-12-01 02:12:30-0500 Xamarin.Android Version: 6.0.0.34 (Starter Edition) Android SDK: /Users/dmitri.toropov/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: 24.4.1 SDK Platform Tools Version: 23.0.1 SDK Build Tools Version: 23.0.1 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.Mac Not Installed Build Information Release ID: 510010006 Git revision: 0b60eecdb531933734519c13257d16a780274aab Build date: 2015-12-04 20:28:20-05 Xamarin addins: 9876fd7c9837977178411ec7375b4352c0a0d6af Build lane: monodevelop-lion-cycle6-baseline Operating System Mac OS X 10.11.2 Darwin Dmitrys-MacBook-Pro.local 15.2.0 Darwin Kernel Version 15.2.0 Fri Nov 13 19:56:56 PST 2015 root:xnu-3248.20.55~2/RELEASE_X86_64 x86_64
The inner-most exception says: The type TestXmlSerializer.DecisionStampPlacement may not be used in this context. Stack Trace: at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteListContent (System.Object container, System.Xml.Serialization.TypeData listType, System.Xml.Serialization.ListMap map, System.Object ob, System.Text.StringBuilder targetString) [0x0025c] in /Users/builder/data/lanes/2506/eb4c1ef1/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs:463 at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteElementMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList) [0x00099] in /Users/builder/data/lanes/2506/eb4c1ef1/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs:255 at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObjectElementElements (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x0000c] in /Users/builder/data/lanes/2506/eb4c1ef1/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs:202 at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObjectElement (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob, System.String element, System.String namesp) [0x00036] in /Users/builder/data/lanes/2506/eb4c1ef1/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs:190 at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObject (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob, System.String element, System.String namesp, Boolean isNullable, Boolean needType, Boolean writeWrappingElem) [0x001ff] in /Users/builder/data/lanes/2506/eb4c1ef1/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs:154 at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteRoot (System.Object ob) [0x00056] in /Users/builder/data/lanes/2506/eb4c1ef1/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs:75 at System.Xml.Serialization.XmlSerializer.Serialize (System.Object o, System.Xml.Serialization.XmlSerializationWriter writer) [0x0001c] in /Users/builder/data/lanes/2506/eb4c1ef1/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs:417 at System.Xml.Serialization.XmlSerializer.Serialize (System.Xml.XmlWriter xmlWriter, System.Object o, System.Xml.Serialization.XmlSerializerNamespaces namespaces) [0x00064] in /Users/builder/data/lanes/2506/eb4c1ef1/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs:480
Created attachment 14223 [details] Fixed the project file Fixed the project file: some of the unneeded dependencies were removed, but Xamarin Studio has not updated the project file so it failed to build.
This bug still occurs on the latest Xamarin 3 versions noted below, and therefore I do not consider this a regression at this time. === Xamarin Studio === Version 5.9.8 (build 0) Installation UUID: 17ea749b-4dee-43b5-afaa-5925246add77 Runtime: Mono 4.0.5 ((detached/1d8d582) GTK+ 2.24.23 (Raleigh theme) Package version: 400050001 === Xamarin.Android === Version: 5.1.9.0 (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) 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: Unknown version Location: /Applications/Xamarin Android Player.app === Apple Developer Tools === Xcode 7.2 (9548) Build 7C68 === Xamarin.iOS === Version: 9.1.0.31 (Business Edition) Hash: bae2cdb Branch: master Build date: 2015-11-09 17:44:57-0500 === Xamarin.Mac === Version: 2.4.0.109 (Business Edition) === Build Information === Release ID: 509080000 Git revision: cc5f6e5658589ca7f46210c57fad947e75f30abd Build date: 2015-10-21 19:27:41-04 Xamarin addins: d77f191bd7d3451adf837b85b38f2b7c60004400 === Operating System === Mac OS X 10.11.2 Darwin Codys-MacBook-Pro.local 15.2.0 Darwin Kernel Version 15.2.0 Fri Nov 13 19:56:56 PST 2015 root:xnu-3248.20.55~2/RELEASE_X86_64 x86_64
Hello Dmitri, Thanks for the bug report and test case. I was able to reproduce the issue on the devices, the pull request below fixes this. https://github.com/mono/mono/pull/2419
Fixed in mono/master 80eb29884c136f0de78a5f4c988bda83d24eb9f0 https://github.com/mono/mono/commit/80eb29884c136f0de78a5f4c988bda83d24eb9f0 Fixed in cycle7 mono/mono-4.3.2-branch 03f2ff096a5310f985b20624c5de4fb5c4ff119d https://github.com/mono/mono/commit/03f2ff096a5310f985b20624c5de4fb5c4ff119d Pending approval on cycle 6 service release 2
I have tried to reproduce this issue with the latest stable build and I am able to reproduce this. I observed that on emulator it shows that "There was an error generating the XML document". Screencast: http://www.screencast.com/t/P7XXzJw91Y I also checked this issue with the following latest Master build: MonoFramework-MDK-4.3.2.431.macos10.xamarin.universal_9f44a62acf718d91320420c1c77e855a63f3c3f9 XamarinStudio-6.0.0.3416_7efe2abe40ba288e7b560660da2c5983d85310c6 mono-android-6.0.99-513_e36688250f2cd85df66024012b8e5ac852505e88 and I observed that emulator and simulator shows the generated XML Document. Screencast: http://www.screencast.com/t/QFMXFIvUrVDy This issue has been fixed and working fine, hence I am closing this issue. Thanks..! Build Info: https://gist.github.com/Rajneesh360Logica/116fa1a27f3ae8bee3cc