Xml.Schema.Linq.FacetsChecker.GetFacetsChecker(XmlTypeCode typeCode) causing strange exception

Apr 14, 2011 at 7:44 PM

We are having an issue with one of our clients servers where randomly (about once a month) during an iis recycle the Linq to Xsd library is getting messed up somehow. When this occurs the declaration (below) results in a TypeIntializationException caused by the exception folling the class listing. This has never happened at other clients and on the other app server at the clients site. I have verified that the app domain is using .Net 2/3.5 and that the 1.* version of Linq to Xsd is installed. The odd thing is that this apparently only happens to string1_Type and messages that don't contain it and instead have string2_Type, string3_Type, etc. function correctly. Once the web service is restarted manually the error disappears. I am hoping that someone has seen this before and can help.    

public sealed class string1_Type {
        public static Xml.Schema.Linq.SimpleTypeValidator TypeDefinition = new Xml.Schema.Linq.AtomicSimpleTypeValidator(XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.String), new Xml.Schema.Linq.RestrictionFacets(((Xml.Schema.Linq.RestrictionFlags)(4)), null, 0, 0, null, null, 1, null, null, 0, null, 0, XmlSchemaWhiteSpace.Preserve));
        private string1_Type() {

---> System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
    at System.ThrowHelper.ThrowKeyNotFoundException()
    at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
    at Xml.Schema.Linq.FacetsChecker.GetFacetsChecker(XmlTypeCode typeCode)
    at Xml.Schema.Linq.AtomicSimpleTypeValidator..ctor(XmlSchemaSimpleType type, RestrictionFacets facets)
    at foo.foo.string1_Type..cctor()