Recently got a customer who had created a BDC application definition file but when trying to import it, he is getting error:
The following error occurred: cannot have more than 255 Parameters for a method .Error was encountered at or just before Line: '1414' and Position '14'.
We checked and found that none of the methods had parameters north of 255. So this error was a little surprising.
Another simple BDC app definition file was imported successfully in same server.
Strangely, the AppDef file with error, was working on another SharePoint farm. In both the farms customer was at build 184.108.40.20621.
Now this is a surprise, same build number and same XML file and 1 farm would let it import and another would just refuse with a misleading error.
So the obvious place to start was to find the root of the error from belly of SharePoint. Started digging into SharePoint RTM version’s source code and found the limit to be 30 parameters per method. Checked and found all the methods in customer’s XML which are causing issue are having more than 30 parameters.
True, this was a limit in RTM build of SharePoint but still the error message says “255” parameters, which is still a mystery.
Checking the further source code and found that somewhere around Build 220.127.116.1131 the limit was updated to 255 parameters for a method.
So that explains the number “255” in error but still none of the methods giving error in customer’s XML file were having more than 255 parameters. It was in range of about 35 parameters for each method.
It was clear now that the issue is in binaries.
Then it was time to go back to customer and ask how SharePoint was installed and what was the patch sequence.
The answer: He installed SharePoint 2007 with SP2 Trial edition and then upgraded to enterprise license. Also he confirmed that all the machines where he installed using the same installer, he is facing the issue with this particular BDC AppDef file. So it does look like binary files issue. The production farm was installed with SharePoint 2007 SP1 Enterprise and then upgraded to SP2.
The resolution? Before we could troubleshoot further to find which binary is causing issue with SharePoint 2007 with SP2 Trial install, customer nuked the test server and rebuilt it again using the SharePoint 2007 SP1 Enterprise and upgraded to SP2 and issue was resolved !!