Sharepoint: DVWP BCS Webpart Error while executing web part: System.InvalidProgramException: Common Language Runtime detected an invalid program
By peter.stilgoe
Came in this morning and had an error on some of our pages displaying external data using business connectivity services in Sharepoint 2010. This was strange as its been working fine for months & as far as I was aware nobody had been doing any work on this.
The error in the Sharepoint logs was:
Error while executing web part: System.InvalidProgramException: Common Language Runtime detected an invalid program
In our case running an IIS reset on our Sharepoint Web Front End servers fixed the problem.
#glitch
SharePoint 2010: BCS External List Throttling
By peter.stilgoe
In Sharepoint 2010 when you are returning rows from an external datasource using External Content Types & External Lists the defaul throttling is set to 2000 rows.
If your datasource is trying to return more than this you will get an error on you external list saying this webpart cannot be displayed etc.
If you have logging turned on for Business Connectivity Services in Central Admin -> Monitoring -> Diagnostic Logging you will see errors similar to this in your Sharepoint Logs:
Error while executing web part: Microsoft.BusinessData.Runtime.ExceededLimitException: Database Connector has throttled the response. The response from database contains more than ’2000′ rows. The maximum number of rows that can be read through Database Connector is ’2000′.
You can change these throttle limits using the following powershell script:
$bdcProxy = Get-SPServiceApplicationProxy | where {$_.GetType().FullName -eq (‘Microsoft.SharePoint.BusinessData.SharedService.’ + ‘BdcServiceApplicationProxy’)}
$dbRule = Get-SPBusinessDataCatalogThrottleConfig -Scope Database -ThrottleType Items -ServiceApplicationProxy $bdcProxy
Set-SPBusinessDataCatalogThrottleConfig -Identity $dbRule -Maximum 5000 -Default 5000



April 5th, 2012
