title: WebService Problem Enum Value is not valid
body: <p>Hi I am having a problem with a c# WebService, it was working fine but suddenly it stopped working, I am getting this error:</p>
  
  <p>Unhandled Exception: System.InvalidOperationException: There is an error in XML document
  System.InvalidOperationException: 'Big' is not a valid value for Sources</p>
  
  <p>Sources is an enum, so I went to my wsdl an it was this way:</p>
  
  <pre><code> &lt; s:simpleType name="Sources"&gt;
  
          &lt;s:restriction base="s:string"&gt;
            s:enumeration value="Invalid" /&gt;
            &lt;s:enumeration value="Any" /&gt;
            &lt;s:enumeration value="RM" /&gt;
            &lt;s:enumeration value="RV" /&gt;
            &lt;s:enumeration value="RD" /&gt;
            &lt;s:enumeration value="LV" /&gt;
          &lt;/s:restriction&gt;
        &lt;/s:simpleType&gt;
  </code></pre>
  
  <p>I could see it didn't have the 'Big' value, so I click on the WebService reference and then Update WebReference, then I went to the wsdl again and now I could see the 'Big' value </p>
  
  <pre><code>&lt; s:simpleType name="Sources"&gt;
  
          &lt;s:restriction base="s:string"&gt;
            &lt;s:enumeration value="Invalid" /&gt;
            &lt;s:enumeration value="Any" /&gt;
            &lt;s:enumeration value="RM" /&gt;
            &lt;s:enumeration value="RV" /&gt;
            &lt;s:enumeration value="RD" /&gt;
            &lt;s:enumeration value="LV" /&gt;
            &lt;s:enumeration value="Big" /&gt;       &lt;--------- This one was added
          &lt;/s:restriction&gt;
        &lt;/s:simpleType&gt;
  </code></pre>
  
  <p>However when I ran it again I got same error. </p>
  
  <p>Unhandled Exception: System.InvalidOperationException: There is an error in XML document
  System.InvalidOperationException: 'Big' is not a valid value for Sources</p>
  
  <p>How could I fix this?
  Seems updating webservice reference was not enough. Am I missing something?</p>
  
  <p>Thanks in advance.</p>
  
  <p>Albert</p>
  
  <p>--Update</p>
  
  <p>I have added this in order to be able to step into the deserializer</p>
  
  <p>?xml version="1.0" encoding="utf-8" ?>
   configuration>
      system.diagnostics>
          switches>
              add name="XmlSerialization.Compilation" value="4" />
          /switches>
      /system.diagnostics>
  /configuration></p>
  
  <p>reference: <a href="http://msdn.microsoft.com/en-us/library/aa302290.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa302290.aspx</a></p>
  
  <p>This is what I found </p>
  
  <p>global::ReVal.Service.BE.WebService.Sources Read1_Sources(string s) {
              switch (s) {
                  case @"Invalid": return global::ReVal.Service.BE.WebService.Sources.@Invalid;
                  case @"Any": return global::ReVal.Service.BE.WebService.Sources.@Any;
                  case @"RM": return global::ReVal.Service.BE.WebService.Sources.@RM;
                  case @"RV": return global::ReVal.Service.BE.WebService.Sources.@RV;
                  case @"RD": return global::ReVal.Service.BE.WebService.Sources.@RD;
                  case @"LV": return global::ReVal.Service.BE.WebService.Sources.@LV;
                  default: throw CreateUnknownConstantException(s, typeof(global::ReVal.Service.BE.WebService.Sources));
              }
          }</p>
  
  <p>Big value is not in the XMLSerializationReader of the webservice.</p>