Corrupt BizTalk orchestrations

Every now and then, when dealing with BizTalk orchestrations, you might encounter issues you can’t explain. Things like the following, infamous error, may occur without any valid reason:

#error: Errors exist for one or more children

Even after fixing every error, you rebuild the project and/or solution, and the error is still not fixed…

I had this issue a couple of times now to be able to recognize the exact behavior… There actually may be nothing wrong with your logic BizTalk orchestration, in fact something may be wrong with the code behind.

Opening your orchestration with the Visual Studio text editor (right click the odx file and choose ‘Open with…’:

corrupt2

In the generated code in the bottom part of the .odx file, you may find the following culprit:

corrupt1

What seems to happen is that, during compilation, Visual Studio will detect an error in your orchestration, but for some reason ends up adding the compiler error into your code.
After fixing the issue in your orchestration and recompiling, the issue persists, because the compiler somehow refuses to remove the error from the code. And thus a Rebuild always results in the same error.

Workaround

An odx file actually consists out of the following structure:

#if __DESIGNER_DATA
#error Do not define __DESIGNER_DATA.
<?xml version=”1.0″ encoding=”utf-8″ standalone=”yes”?>
<om:MetaModel MajorVersion=”1″ MinorVersion=”3″ ……
………..
……….
</om:Element>
</om:MetaModel>
#endif // __DESIGNER_DATA
[Microsoft.XLANGs.BaseTypes.BPELExportable(false)]
module MyNamespace.MyOrchestration
{
internal messagetype myMsg
….
….
….
}

As you can see, the first part is “DESIGNER_DATA“. This part actually contains an XML representation of your orchestration. The size, shape and position of all of your shapes for example, each of their ID’s, the code you’ve written into expression shapes, etc….

After that part comes the generated code, which is written by Visual Studio each time your orchestration gets recompiled/rebuilt.

The trick is to remove the part after the following line:

#endif // __DESIGNER_DATA

Then, open the orchestration in the designer and make any change to it.

This will force the compiler to regenerate the code from scratch, which results in a correct version of the code (without the #error in it).
Another way would be to remove the line where the #error is in, but I find it safer to let it regenerate everything.

This should fix the issues you have while recompiling/rebuilding the BizTalk orchestration.

One more thing:
Once you opened an .odx file via the Visual Studio Text/XML Editor, you ‘ll need to fix your BizTalk project or your orchestration will always open that editor on double-click, instead of the BizTalk orchestration designer.
Find out how to do this in a blog post I wrote, dealing with just that issue.

Hope this helps! Let me know if it did!
Cheers, Pieter

Advertisements

BizTalk orchestration keeps opening in Visual Studio text editor

You may know the issue when opening a BizTalk orchestration and it opens like this:

orcheditor1
Note: I blurred the code to protect the name of my client.

Not much you can do about it, except right-clicking the orchestration and clicking ‘Open With…’ and choosing the BizTalk Orchestration Designer.

orcheditor2

However, if you close the BizTalk Orchestration Designer again, and double-click the odx file, it once again opens in the first, yet useless, view.

An easy fix

The culprit is actually not in the orchestration, but can be found in the BizTalk project (.btproj) file:

Open the Visual Studio BizTalk project (.btproj file) containing the orchestration with your favorite editor and search for ‘Designer’:

orcheditor3

You’ll notice that the orchestration, which refuses to open in the Orchestration Designer, actually has a node SubType which is set to “Designer“.

Now remove the line containing this node from the file in your editor, save the file and reload the file in Visual Studio.
If you now double-click the orchestration, it now opens in the BizTalk Orchestration Designer again!

Don’t forget to check-in/commit your changes 😉

Hope this helps! Cheers!
Pieter