Gregory Van de Wiele, a fellow BizTalk MVP, wrote to me a couple of weeks ago with some good information on how to catch XML Schema errors thrown by the XML Disassembler Component in a BizTalk pipeline when using my BizTalk PipelineTesting library. Here's the scoop:
In order to find a real XML schema error, when using XMLDASM component for validating, you need to do this:
- Inside your test, catch type XmlDasmException
- You won’t find the real schema validation error using the Message or ExtendedDescription prop: both are empty
- GetArgument(0) does the trick. Alternatively you could call the GetErrorMessage(Exception) on the Utilities type in the Microsoft.Test.BizTalk.PipelineObjects
It took me quite some time because I somehow overlooked the private ‘arguments’ collections in the debugger. Maybe other people will make the same mistake.
Thanks for the tip, Gregory, I'm sure other people will find it useful! As soon as I find some free time, I'll update the PipelineTesting library with this and other suggestions Gregory passed on! If anyone has other suggestions or feature requests, now is the time for them :-)