Bug 29565 - XmlDeserializer lacks XElement support.
Summary: XmlDeserializer lacks XElement support.
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.XML (show other bugs)
Version: 3.12.0
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-04-29 22:40 UTC by Cody Beyer (MSFT)
Modified: 2015-05-15 21:03 UTC (History)
2 users (show)

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


Attachments

Description Cody Beyer (MSFT) 2015-04-29 22:40:30 UTC
### Description 

The below linked app demonstrates an XML de-serialization failure that succeeds on Windows

### Test Case

https://www.dropbox.com/s/gtmcpe7ueh9cwje/xmltestfiles.zip?dl=0

### StackTrace

https://gist.github.com/CodyBeyer/438e44d014581016f204

### Steps To Reproduce

1. Open linked sample in Xamarin Studio on Mac
2. Run in debug

### Expected Results

App should deserialize XML to display in console window. This is the behavior if ran on Windows

### Actual Results

Above linked exception is thrown

### Version

=== Xamarin Studio ===

Version 5.9 (build 431)
Installation UUID: ad159da4-fe22-4bfe-8be6-52e4b844ec90
Runtime:
	Mono 4.0.0 ((detached/d136b79)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400000143

=== Apple Developer Tools ===

Xcode 6.3.1 (7703)
Build 6D1002

=== Xamarin.iOS ===

Version: 8.10.0.267 (Business Edition)
Hash: 6481535
Branch: master
Build date: 2015-04-27 04:38:13-0400

=== Xamarin.Mac ===

Version: 2.0.0.262 (Business Edition)

=== Xamarin.Android ===

Version: 5.1.0.115 (Business Edition)
Android SDK: /Users/beyerc/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.2   (API level 17)
		4.4   (API level 19)
		5.0   (API level 21)
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

=== Build Information ===

Release ID: 509000431
Git revision: 7560726734fc7267de2fa9abed2509968deefaa8
Build date: 2015-04-17 19:25:48-04
Xamarin addins: 2e772c734ab3148054eae7bf8949f340fdeb5e5e

=== Operating System ===

Mac OS X 10.10.3
Darwin Codys-MacBook-Pro.local 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
Comment 1 Miguel de Icaza [MSFT] 2015-05-15 20:41:38 UTC
This is an attempt to cast a System.Xml.XmlElement into a System.Xml.Linq.XElement

System.InvalidOperationException: There is an error in XML document. ---> System.InvalidCastException: Cannot cast from source type to destination type.
  at (wrapper managed-to-native) System.Array:SetValueImpl (System.Array,object,int)
  at System.Array.SetValue (System.Object value, Int32 index) [0x00046] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/corlib/System/Array.cs:636 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.AddListValue (System.Xml.Serialization.TypeData listType, System.Object& list, Int32 index, System.Object value, Boolean canCreateInstance) [0x00028] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:741 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList, Boolean readBySoapOrder) [0x008ce] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:486 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanceMembers (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:240 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstance (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x000df] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:230 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x00031] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:193 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObjectElement (System.Xml.Serialization.XmlTypeMapElementInfo elem) [0x0005c] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:632 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList, Boolean readBySoapOrder) [0x0061a] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:443 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanceMembers (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:240 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstance (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x000df] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:230 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x00031] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:193 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot (System.Xml.Serialization.XmlTypeMapping rootMap) [0x00062] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:184 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot () [0x00028] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:87 
  at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.Serialization.XmlSerializationReader reader) [0x0001c] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs:357
Comment 2 Miguel de Icaza [MSFT] 2015-05-15 20:47:11 UTC
Workaround:

Replace the use of XElement with XmlElement in the ws-discovery.cs
Comment 3 Miguel de Icaza [MSFT] 2015-05-15 21:03:11 UTC
This is a new feature, we do nto currently have plans to implement it.

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