After several days migrating BizTalk open-source contributions like BizTalk Mapper Extensions UtilityPack, BizTalk Pipeline Components Extensions Utility Pack, BizTalk MapperExtensions Functoid Project Template, BizTalk MapperExtensions Functoid Wizard and several tools like BizTalk Filter Finder Tool, BizTalk Bindings Exporter Tool, or BizTalk Port Multiplier Tool for BizTalk Server 2020. It is time to get back to one of my favorite topics error and warnings, cause, and solutions blog post. This time on a small development issue that I got recently while I was trying to Consume Adapter Service to generate the Oracle schemas inside Visual Studio.
I have done these thousands of times and it is a very straightforward task once you know how to communicate with Oracle system but this time I got the following error:
Error occurred while creating the BizTalk port configuration file. Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
A curiosity is that the Wizard was able to successfully generate the Oracle Schemas. The problem occurred while it was trying to generate the Binding file.
Unfortunately, I don’t know exactly the cause reason for this error. In my view, the same occurred due to some special character coming from the Oracle resources that are being consumed or incompatibilities between Oracle data types and .NET data types and that are used to generate the Binding file.
Nevertheless, this is not a stopping issue. You still have all the necessary BizTalk resources generated by the wizard: the Oracle schemas. The only thing that is not generated is the binding file, which is extremely useful to create the receive or send port in the BizTalk Server Administration Console. However, despite this constraint, you are still able to manually create the port without requiring the binding file.
Well, you know me, it is possible to manually create the ports without requiring the binding files, however, this is an accelerator that I prefer not to lose. So, I had to investigate and solve this problem, before it appears more often.
And in fact, the solution is quite easy:
- On the Consume Adapter Service Schema Generator Wizard, while you are configuring the connection string to Oracle, configure the URI, select the Binding Properties tab.
- On the Binding Properties tab, scroll down to the Metadata section. There you will find a property called: EnableSafeTyping.
- This feature controls how the adapter surfaces certain Oracle data types and by default this value is false.
- To solve this issue you need to change the EnableSafeTyping value to true.
Since not all .NET and Oracle types are created equally, we occasionally need to set the value true for this property to handle some constraints around data types.
This is not a unique Oracle issue, this same error may happen when you are trying to generate schemas from SAP also.