Wednesday, November 14, 2007

Stupid, Stupid, Stupid... Me!

I hate to admit that I have been plagued by this stupid BizTalk error for weeks now.  I must say that I haven't been focusing on this particular issue the entire time, but when I did it wasn't pretty.  I was never able to wrap my head around the problem, and even worse, the solution.  Until...

The error:
MyOrchestration.odx(783,59): error CS1026: ) expected
MyOrchestration.odx(782,10): error CS1518: Expected class, delegate, enum, interface, or struct

I would receive this error only when a particular orchestration was included in my project.  However, the orchestration that reports the error is not the one causing the error, but the first active orchestration in my directory.  If I set the build action of the offending orchestration to none, the error would go away.  I can say this with 100% certainty that this was the root of my problem as I tried all combinations of which orchestrations were included and found only one causing me grief.

Being the friendly error message that it was, I opened the orchestration using the Xml Editor and took a look under the hood.  The line being referenced was the last line of the file.  In other words, there was no code where the error was supposed to be.  In the past, I had run in to cases where the generated C# code was corrupt, so I deleted all of that section and started over.  Still, I got the same error.  I even tried deleting that orchestration and starting from scratch.  I finally was able to narrow it down to an error somewhere in my mapping and schema files.  Further analysis showed me that the schema reference section was including some very strange data.  Essentially, my source schema looked something like this:

<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://schemas.companyname.com/projectname/FileType_FF&quot; targetNamespace=&quot;http://schemas.companyname.com/projectname/FileType_FF" targetNamespace="http://schemas.companyname.com/projectname/FileType_FF&quot; targetNamespace=&quot;http://schemas.companyname.com/projectname/FileType_FF" xmlns:xs="http://www.w3.org/2001/XMLSchema">

Since this schema was created using the Flat File Wizard, I'm not entirely certain how in the world this happened, but it sure did throw me for a loop.  Especially because the error message had nothing to do with the actual error.  Googling for the error message didn't return any helpful results.  If you are one of the unlucky souls to receive this error, hopefully this will give you some assistance.

No comments: