Thursday, December 13, 2012

mismatched ‘braces’ ‘{}’

Working on a project that involved a lot of changes to existing orchestrations I got this strange build error:
unexpected keyword: ‘service’                      MyOrchestration_1
unexpected keyword: ‘module’                     MyOrchestration_1
mismatched ‘braces’ ‘{}’                              MyOrchestration_2

I had been working on MyOrchestration_2 but not with MyOrchestration_1.
Reverting the changes on MyOrchestration_2 solved the problem but when adding my changes again the build error came back.
My own changes were valid and did not contain any missing closing braces. Something else had happened under the hood of Visual Studio.
I found the solution in a MSDN forum that discussed the problem.
Anders Elmén from Need2Code AB gave me the solution (I have left out some of code for better formatting):
I've got exactly the same issue with Visual Studio 2010 and BizTalk 2010.
Besides that the memory gets corrupt every now and then, especially when adding a new variable in a scope, this braces issue is verry annoying.
What's happening is that somewhere in VS2010 the Orcestration greneration class misses to add an closing of braces to the last body in the configuration.
1. Open your orchestration with notepad and look at the end of the file.
2. Add the missing brace closing.
3. Restart your VS2010 environment.
Sample of .odx file with missing closing brace.
    internal service Configuration
        port uses PortType_2 EIPMgmtDb;
        message [.......] Select;
        message [......]  SelectResponse;
        System.Xml.XmlDocument xmlDoc;
        body (System.Int32 ApplicationID, System.String KeyValue, out System.String ReturnValue)
        [Add your closing braces here. Note that i can be more than one missing brace if you are using scopes or groups]
/Anders Elmén
And now, looking at the code abowe (that I edited) I realized that I recognise the naming of some of the objects. Making some extended investigation I found that Anders Elmén actually worked as a consultatnt on the company I'm at. Thoough this is not the same project as I had problems with it is not that far fetched that Anders and I are actually having this problem in the same virtual development environment. Small world!

And Anders, if you read this - I don´t like the whay you named and structured the maps in the project. But on the other hand, it may not have been you that set up the original structure...

BizTalk orchestration opens with #if __DESIGNER_DATA

I am currently working on a project having a bunch of orchestrations that have existed for a while. What the previous developers did with them I don't know but when double clicking on them they are opened in the Designer with a bunch of meta tags.

#if __DESIGNER_DATA #error Do not define __DESIGNER_DATA. #endif // __DESIGNER_DATA [Microsoft.XLANGs.BaseTypes.BPELExportable(false)]

The orchestration can be onpend right clicking on it in the Solution Explorer selecting "Open With..." and then selecting "BizTalk Orchestration Designer (Default)".

This behaviour is annoying and I wanted to fix it. As usual Google is your friend.
I found this blog giving me the solution:

This problem was apparently created by someone manually editing the orchestrations using an XML editor.
The fix is to open  project file (.btproj) in a text editor. Find the section similar to this:
    <XLang Include="MyOrch.odx">
Delete the <SubType> element and save your changes. Now the orchestration should open as normal.