title: Why is XmlReader not validating restriction constraint
body: <p>I'm trying to validate an xml string with a schema and am running into an issue where it's not recognizing restrictions in the xsd using <a href="http://www.w3schools.com/schema/schema_facets.asp" rel="nofollow">facets</a>. I've created a unit test where I'm serializing an object into an xml, validating the xml using my schema and deserializing the xml back to the object. Everything works great, but for some reason I'm not getting an error when my latitude is within the range specified in the schema. I've defined a latitude to be within -90 to 90 however I'm not getting an error when I'm exceeding the bound. Here's the xml I get after serializing:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Messages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;Message&gt;    
      &lt;Blocks&gt;
        &lt;Location&gt;
          &lt;Latitude&gt;110.5&lt;/Latitude&gt;
          &lt;Longitude&gt;11.5&lt;/Longitude&gt;
          &lt;IsValid&gt;true&lt;/IsValid&gt;
          &lt;PrecisionKilometers&gt;1&lt;/PrecisionKilometers&gt;
        &lt;/Location&gt;      
      &lt;/Blocks&gt;
    &lt;/Message&gt;  
  &lt;/Messages&gt;
  </code></pre>
  
  <p>The schema that I'm using is shown below. The relevant part with the latitude is in the middle. (I know it's a bit ugly and I'm trying to get them to optimize their schema generation code)</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-16"?&gt;
  &lt;xs:schema xmlns:VL="http://customUri" elementFormDefault="qualified" targetNamespace="http://customUri" id="MessageList" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;xs:element name="Messages"&gt;
      &lt;xs:complexType&gt;
        &lt;xs:sequence&gt;
          &lt;xs:element minOccurs="1" maxOccurs="unbounded" name="Message" nillable="true"&gt;
            &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                &lt;xs:element minOccurs="1" maxOccurs="unbounded" name="Blocks"&gt;
                  &lt;xs:complexType&gt;
                    &lt;xs:all&gt;
  
                      &lt;xs:element minOccurs="0" maxOccurs="1" name="Location" nillable="true"&gt;
                        &lt;xs:complexType&gt;
                          &lt;xs:sequence&gt;
                            &lt;xs:element minOccurs="1" maxOccurs="1" name="Latitude"&gt;
                              &lt;xs:simpleType&gt;
                                &lt;xs:restriction base="xs:double"&gt;
                                  &lt;xs:minInclusive value="-90" /&gt;
                                  &lt;xs:maxExclusive value="90" /&gt;
                                &lt;/xs:restriction&gt;
                              &lt;/xs:simpleType&gt;
                            &lt;/xs:element&gt;
                            &lt;xs:element minOccurs="1" maxOccurs="1" name="Longitude"&gt;
                              &lt;xs:simpleType&gt;
                                &lt;xs:restriction base="xs:double"&gt;
                                  &lt;xs:minInclusive value="-180" /&gt;
                                  &lt;xs:maxExclusive value="180" /&gt;
                                &lt;/xs:restriction&gt;
                              &lt;/xs:simpleType&gt;
                            &lt;/xs:element&gt;
                            &lt;xs:element minOccurs="1" maxOccurs="1" name="IsValid" type="xs:boolean" /&gt;
                            &lt;xs:element minOccurs="0" maxOccurs="1" name="PrecisionKilometers" nillable="true" type="xs:double" /&gt;
                          &lt;/xs:sequence&gt;
                        &lt;/xs:complexType&gt;
                      &lt;/xs:element&gt;
  
                    &lt;/xs:all&gt;
                  &lt;/xs:complexType&gt;
                &lt;/xs:element&gt;
              &lt;/xs:sequence&gt;
            &lt;/xs:complexType&gt;
          &lt;/xs:element&gt;
        &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>My settings for reading the xml are: (notice I'm specifying flags for ReportValidationWarnings and ProcessIdentityContraints as well as using a validation handler to detect warnings)</p>
  
  <pre><code>    var settings = new XmlReaderSettings
            {
              ValidationType = ValidationType.Schema,
              ValidationFlags =         
                XmlSchemaValidationFlags.ReportValidationWarnings |
                XmlSchemaValidationFlags.ProcessInlineSchema |
                XmlSchemaValidationFlags.ProcessSchemaLocation |
                XmlSchemaValidationFlags.ProcessIdentityConstraints |
                XmlSchemaValidationFlags.AllowXmlAttributes,
              IgnoreWhitespace = true,
              IgnoreComments = true,
            };
  settings.ValidationEventHandler += (o, ex) =&gt;
            {            
              if (ex.Severity == XmlSeverityType.Warning || ex.Severity == XmlSeverityType.Error)
              {
                //do something
              }
            };
      settings.Schemas.Add(mySchemaSet);
  </code></pre>
  
  <p>The code I'm using to deserialize is pretty standard.</p>
  
  <pre><code>XmlReader reader = XmlReader.Create(memoryStreamContainingXml, settings);
  var serializer = new XmlSerializer(typeof(MessageList));
  MessageList returned = ser.Deserialize(reader) as MessageList;
  </code></pre>
  
  <p>I also tried doing a <code>while(reader.read(){})</code> instead of deserializing to see if a validation error is thrown but I'm not getting any issue.</p>