
Hi,
When the schema resolver is used to load an xml schema that is syntatically invalid no exception is thrown.
At the next parse cycle a System.Xml.Schema.XmlSchemaException is thrown on the AmbientParseRequestDispatcherProvider and my entire application crashes.
The Application_DispatcherUnhandledException does not catch this situation.
Is there any way to catch this exception?
To reproduce.
1. Save the following xml schema (which has an invalid elemnet) as an xsd file.
<xs:schema id="BadElementExampleXsd"
targetNamespace="BadElementExampleXsd"
elementFormDefault="qualified"
xmlns="BadElementExampleXsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="BadElement" type="MissingElementType" />
<xs:element name="GoodElement" type="GoodElementType" / >
<xs:complexType name="GoodElementType" >
<xs:attribute name="Name" type="xs:string" />
</xs:complexType>
</xs:schema>
2. Using the "Actipro WFP Controls Sample Browser", open the Schema file from 1) via the Synax Editor Xml Editor
3. The "Actipro WFP Controls Sample Browser" will crash.
Here is a sample call stack
System.Xml.Schema.XmlSchemaException was unhandled
HResult=-2146231999
Message=Type 'BadElementExampleXsd.MissingElementType' is not declared.
Source=System.Xml
LineNumber=19
LinePosition=4
SourceUri=""
StackTrace:
at System.Xml.Schema.XmlSchemaSet.InternalValidationCallback(Object sender, ValidationEventArgs e)
at System.Xml.Schema.BaseProcessor.SendValidationEvent(XmlSchemaException e, XmlSeverityType severity)
at System.Xml.Schema.Compiler.CompileElement(XmlSchemaElement xe)
at System.Xml.Schema.Compiler.Compile()
at System.Xml.Schema.Compiler.Execute(XmlSchemaSet schemaSet, SchemaInfo schemaCompiledInfo)
at System.Xml.Schema.XmlSchemaSet.Compile()
at ActiproSoftware.Text.Languages.Xml.Implementation.XmlSchemaResolver.#jNc()
at ActiproSoftware.Text.Languages.Xml.Implementation.XmlSchemaResolver.get_SchemaSet()
at ActiproSoftware.Text.Languages.Xml.Implementation.XmlValidator.#qNc(ISyntaxLanguage #p0c)
at ActiproSoftware.Text.Languages.Xml.Implementation.XmlValidator.Validate(IParseRequest request, IAstNode ast)
at ActiproSoftware.Text.Languages.Xml.Implementation.XmlParserBase.Validate(IParseRequest request, IParserState state)
at ActiproSoftware.Text.Languages.Xml.Implementation.XmlParserBase.CreateParseData(IParseRequest request, IParserState state)
at ActiproSoftware.Text.Parsing.LLParser.Implementation.LLParserBase.Parse(IParseRequest request)
at ActiproSoftware.Text.Parsing.Implementation.ThreadedParseRequestDispatcher.#0Yc.#nXc(IParseRequest #FMc)
at ActiproSoftware.Text.Parsing.Implementation.ThreadedParseRequestDispatcher.#0Yc.#56c()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Thanks,
Tim