I have a utility class with several methods related to XML schemas. Without any code changes or any changes in the environment, he suddenly began to systematically refuse.
Failed to execute this method:
public static XmlSchema GetSchema(string xsdFileName) { string path = MyConfiguration.XmlSchemaLocation; if (!path.EndsWith(@"\")) { path += @"\"; } path += xsdFileName; return XmlSchema.Read(File.OpenRead(path), null); }
The stack trace shows XmlSchema.Read internally trying to create a Parser object, and the constructor of this tries to read some configuration, and this, in turn, leads to the analysis of some policies, and then it explodes with a COMException with an error code, which if I correct I understand, does not give more information than an unexpected error!
Here's an exception:
System.Runtime.InteropServices.COMException (0x8000FFFF): Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) at System.Security.Policy.PEFileEvidenceFactory.GetLocationEvidence(SafePEFileHandle peFile, SecurityZone& zone, StringHandleOnStack retUrl) at System.Security.Policy.PEFileEvidenceFactory.GenerateLocationEvidence() at System.Security.Policy.PEFileEvidenceFactory.GenerateEvidence(Type evidenceType) at System.Security.Policy.AssemblyEvidenceFactory.GenerateEvidence(Type evidenceType) at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type) at System.Security.Policy.Evidence.GetHostEvidence(Type type, Boolean markDelayEvaluatedEvidenceUsed) at System.Security.Policy.AppDomainEvidenceFactory.GenerateEvidence(Type evidenceType) at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type) at System.Security.Policy.Evidence.RawEvidenceEnumerator.MoveNext() at System.Security.Policy.Evidence.EvidenceEnumerator.MoveNext() at System.Configuration.ClientConfigPaths.GetEvidenceInfo(AppDomain appDomain, String exePath, String& typeName) at System.Configuration.ClientConfigPaths.GetTypeAndHashSuffix(AppDomain appDomain, String exePath) at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig) at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig) at System.Configuration.ClientConfigurationHost.RequireCompleteInit(IInternalConfigRecord record) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSection(String configKey) at System.Configuration.ConfigurationManager.GetSection(String sectionName) at System.Xml.Schema.Parser..ctor(SchemaType schemaType, XmlNameTable nameTable, SchemaNames schemaNames, ValidationEventHandler eventHandler) at System.Xml.Schema.XmlSchema.Read(XmlReader reader, ValidationEventHandler validationEventHandler) at MyProj.Common.XSDValidator.GetSchema(String xsdFileName) at ...
Any idea how to explore this further? Does anyone know what could lead to this happening (for example, a damaged user profile for identification, under which the process is running)?
This happened in a production environment, and I really don't know how to start figuring out what caused it, or fixing it.
In case it is relevant: the code is placed in the console application. Please note that the code successfully reached the configuration shortly before it exploded. (The "MyConfiguration" class is another utility class, which is basically a thin layer encapsulating a bunch of appSettings keys that uses the regular System.Configuration.ConfigurationManager class.)
Windows version:
OS Name: Microsoft® Windows Server® 2008 Datacenter OS Version: 6.0.6002 Service Pack 2 Build 6002 OS Manufacturer: Microsoft Corporation OS Configuration: Member Server OS Build Type: Multiprocessor Free