Illegal name-hiding and symbol is already defined errors

by eliasen 9. april 2007 21:40

Hi

I have just written a blog post about using the SQL Adapter Wizard and during my tests for this post, I found the cause of an error that I saw someone in the newsgroups ask about. So I will just post the answer here.

I got these errors when compiling my project, in which I have used the SQL Adapter Wizard twice to create a schema for me:

Error 1 illegal name-hiding: 'Orchestration_1' hides 'SQLAdapter.Orchestration_1' on line 101 C:\Projects\BTS 2006\BlogEntries\SQLAdapter\BizTalk Orchestration_1.odx 102 23 

Error 2 symbol 'Orchestration_1' is already defined; the first definition is in file C:\Projects\BTS 2006\BlogEntries\SQLAdapter\BizTalk Orchestration.odx on line 101 C:\Projects\BTS 2006\BlogEntries\SQLAdapter\BizTalk Orchestration_1.odx 102 23

It turns out, that when you use the SQL Adapter Wizard to automatically create schemas for you, then an orchestration is also created for you. Yes, I knew that, you say? Well, so did I :-) What I didn't know was that the Wizard is clever enough to give the two orchestrations different filenames, but stupid enough to give them both the .NET type name "Orchestration_1". So when compiling the project, you have two orchestrations with the same fully qualified typename, which off course will fail.

See this screenshot:

As you can see at the lower right vorner of the picture, the "BizTalk Orchestration_1.odx" has "Orchestration_1" as its typename. Well, "BizTalk Orchestration.odx" has the same.

"So I just change one of them, no problem", you say? Well, there is another problem... If you look at the port types and multi-part message types in each orchestration, they are also given the same names. So changing the typename of one of the orchestrations removes the compilation error, but it will just give you the next set of errors, as more things are given the same name, and therefor more illegal name-hiding is taking place. Se the post here about what you can do to rename things.

I hope this helps someone.

--
eliasen

Tags:

BizTalk 2006

Notes about using the SQL Adapter Wizard

by eliasen 9. april 2007 21:27

Hi

When using the SQL Adapter wizard to generate schemas for updategrams, queries or calling stored procedures, the wizard will create an orhestration and a schema for you in your project. The orchestration is named BizTalk Orchestration.odx (or if this allready exists, then it will add _1, _2 and so on) and the xsd will be called SQLService_<chosen_rootnode_in_wizard>.xsd

These names are of course not useful in most scenarios, since most projects have naming conventions that must be followed. Moreover, the orchestration is often just annoying, since the database read/update usually must happen in an allready existing orchestration.

What you should do is this:

  1. Rename the xsd to follow your naming conventions
  2. Rename the typename of the schema to match the filename
  3. Open the automatically created orchestration, and:
    • Update the parts of the two created multi-part messages to point to the new typename of the schema
    • Rename the port type that is created to something meaningful
    • Rename the multi-part message types that are created to be more meaningful.
    • The last two steps are very important, if you plan to use the SQL Adapter more than once in the same orchestration, since otherwise you will get type names in both generated orchestrations that are the same. And this isn't allowed, off course.
  4. Cut and paste the port type and multi-part message types from BizTalk Orchestration.odx to the orchestration where you actually need them.
  5. Delete the BizTalk Orchestration.odx file, since it is no longer needed.

So basically, the automatically created names of things when using the SQL Adapter Wizard are useless. And also, the created orchestration is useless after moving the automatically created types away from it.

I hope this is useful for someone at some point.

--
eliasen

Tags:

BizTalk 2006

About the author

Jan Eliasen is 37 years old, divorced and has 2 sons, Andreas (July 2004) and Emil (July 2006).

Jan has a masters degree in computer science and is currently employed at Logica Denmark as an IT architect.

Jan is a 6 times Microsoft MVP in BizTalk Server (not currently an MVP) and proud co-author of the BizTalk 2010 Unleashed book.

BizTalk Server 2010 Unleashed


Buy from Amazon

Microsoft MVP


6 times: July 2004, July 2008, July 2009, July 2010, July 2011, and July 2012. Not currently an MVP.

MCTS

Image to show

Month List

Page List