Bug 27928 - XmlException() has the wrong HResult value and Default message
Summary: XmlException() has the wrong HResult value and Default message
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.XML ()
Version: 3.10.0
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-03-11 17:50 UTC by nader
Modified: 2015-03-17 16:58 UTC (History)
4 users (show)

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 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:

Description nader 2015-03-11 17:50:08 UTC
The XmlException class has the wrong HResult and Default message value.

To reproduce this issue run the following code snippet

System.Xml.XmlException v5 =  new System.Xml.XmlException();
int hResult = v5.HResult;
string message = v5.Message;

Expected output: 
hResult = -2146232000, message = "An XML error has occurred."

Xamarin Android output: 
hResult = -2146233087, message = "A system exception has occurred."

The code The expected output occurs in .Net 4.5 on the Desktop and the 

The code snippet above was placed in a PCL project and was run on an android 4.4.2
emulator and a Windows Phone 8.1 emulator and .Net 4.5 on the Desktop

Additional Build Environment info:
Xamarin.Android Version: 4.16.0 (Business Edition)
Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_39
Comment 1 Jonathan Pryor 2015-03-12 09:19:20 UTC
This is a Mono class library bug:

  $ csharp -r:System.Xml;
  csharp> var x = new System.Xml.XmlException ();
  csharp> x.HResult;
  csharp> x.Message;
  "A system exception has occurred."
Comment 2 Atsushi Eno 2015-03-17 16:58:51 UTC
Regardless of whether we have already imported XmlException from referencesource, HResult and message value difference cannot be a bug. They are not documented feature at all.