Bug 25474 - Behavior of [XmlText] differs for "" entry
Summary: Behavior of [XmlText] differs for "" entry
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.XML ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-12-17 11:25 UTC by diva
Modified: 2015-05-15 04:31 UTC (History)
2 users (show)

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


Attachments
Failing test case (2.07 KB, text/plain)
2014-12-17 11:25 UTC, diva
Details


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.

Related Links:
Status:
RESOLVED FIXED

Description diva 2014-12-17 11:25:59 UTC
Created attachment 9106 [details]
Failing test case

See attached test case. The input file is assumed to be called "Program.xml" and it contains the following:

In .Net, the attached program results in the following output:
$ ./XmlTest.exe
0

In mono/linux, I get a NullRef exception because the textfield is null.

me@myserver:~/tmp> mono XmlTest.exe

Unhandled Exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
  at ArrayTest.Program.ConvertFromArray (System.Double[] values) [0x00000] in <filename unknown>:0
  at ArrayTest.Program.get__Text_ () [0x00000] in <filename unknown>:0
  at System.Reflection.MonoProperty.GetterAdapterFrame[T,R] (System.Reflection.Getter`2 getter, System.Object obj) [0x00000] in <filename unknown>:0
  at System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlTypeMapMember.GetValue (System.Object ob) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.GetMemberValue (System.Xml.Serialization.XmlTypeMapMember member, System.Object ob, Boolean isValueList) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList, Boolean readBySoapOrder) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanceMembers (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstance (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot (System.Xml.Serialization.XmlTypeMapping rootMap) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot () [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.Serialization.XmlSerializationReader reader) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
  at ArrayTest.Program.ConvertFromArray (System.Double[] values) [0x00000] in <filename unknown>:0
  at ArrayTest.Program.get__Text_ () [0x00000] in <filename unknown>:0
  at System.Reflection.MonoProperty.GetterAdapterFrame[T,R] (System.Reflection.Getter`2 getter, System.Object obj) [0x00000] in <filename unknown>:0
  at System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlTypeMapMember.GetValue (System.Object ob) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.GetMemberValue (System.Xml.Serialization.XmlTypeMapMember member, System.Object ob, Boolean isValueList) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList, Boolean readBySoapOrder) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanceMembers (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstance (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot (System.Xml.Serialization.XmlTypeMapping rootMap) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot () [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.Serialization.XmlSerializationReader reader) [0x00000] in <filename unknown>:0
Comment 1 diva 2014-12-17 11:28:48 UTC
Sorry, the first paragraph of the bug description should be there (can't edit?). The attached program already creates the problematic xml file.
Comment 2 diva 2014-12-17 14:11:54 UTC
Mono version: happens both in 3.8 and 3.10.0
Comment 3 Marek Safar 2015-05-15 04:31:34 UTC
Fixed in master