Symptoms
When you use a sandbox solution or web part, you may receive the error messages that resemble the following in SharePoint Unified Logging System (ULS) logs. These messages indicate some sandbox solutions or web parts are blocked.
For SharePoint Foundation 2013 and SharePoint Enterprise Server 2016 with the May 2022 security update installed:
Event ID |
Message |
ajrme |
ExecuteRequestInSandBox call failed. System.ArgumentException: Type was not resolvable at Microsoft.SharePoint.UserCode.SPUserCodeExecutionManager.SPUserCodeSerializationBinder.BindToType(String assemblyName, String typeName) at …... |
ajlz0 |
Getting Error Message for Exception System.ArgumentException: Type was not resolvable at Microsoft.SharePoint.UserCode.SPUserCodeExecutionManager.SPUserCodeSerializationBinder.BindToType(String assemblyName, String typeName) at …... |
For SharePoint Foundation 2013 with the June 2022 security update or a later security update installed and for SharePoint Enterprise Server 2016 with the July 2022 security update or a later security update installed:
Event ID |
Message |
6k389 |
Invalid type: type=XXXXX; assembly=YYYYY, in SPUserCodeSerializationBinder. Visit https://go.microsoft.com/fwlink/?LinkId=2196531 for more information and to learn how to resolve this error. |
ajrme |
ExecuteRequestInSandBox call failed. System.ArgumentException: Type was not resolvable at Microsoft.SharePoint.UserCode.SPUserCodeExecutionManager.SPUserCodeSerializationBinder.BindToType(String assemblyName, String typeName) at …... |
ajlz0 |
Getting Error Message for Exception System.ArgumentException: Type was not resolvable at Microsoft.SharePoint.UserCode.SPUserCodeExecutionManager.SPUserCodeSerializationBinder.BindToType(String assemblyName, String typeName) at …... |
Cause
Starting with the May 2022 security update, the SharePoint sandbox service further restricts the types and assemblies it allows to be run by default.
Resolution
To fix this issue, you have to register third party's types or assemblies that the SharePoint sandbox service will allow to be run. To do this, follow these steps:
-
For SharePoint Foundation 2013, install the June 2022 security update or a later security update. For SharePoint Enterprise Server 2016, install the July 2022 security update or a later security update.
-
Use the impacted sandbox solution or web part to trigger the issue.
-
Open the SharePoint ULS log and look for the event ID "6K389". You will find the following message with that event ID:
Invalid type: type=XXXXX; assembly=YYYYY in SPUserCodeSerializationBinder. Visit https://go.microsoft.com/fwlink/?LinkId=2196531 for more information and to learn how to resolve this error.
-
Note the types and assemblies that are blocked.
-
Open the web.config file of the web application where the Sandbox Solutions or webparts are located. The path of the web.config would typically look like the following:
C:\inetpub\wwwroot\wss\VirtualDirectories\<web application port> -
Add an AllowedListItems element in the configuration/SharePoint/SafeMode section.
-
Inside the AllowedListItems element, add an AllowedItem element with the Name attribute set to AllowedSandboxType in the following format:
-
To unblock specific types, add elements with the Type property as follows: <AllowedItem Name="AllowedSandboxType" Type="XXXXX"/>
-
To unblock specific assemblies, add elements with the Assembly property as follows:<AllowedItem Name="AllowedSandboxType" Assembly="YYYYY"/>
The following is an example:
<SafeMode
MaxControls = "200"
CallStack = "false"
DirectFileDependencies ="10"
TotalFileDependencies = "250"
AllowPageLevelTrace = "false"
ControlCompatMode="false"
>
<PageParserPaths>
</PageParserPaths>
<AllowedListItems>
<AllowedItem Name="AllowedSandboxType" Type="Microsoft.SharePoint.Portal.WebControls.RSSAggregatorWebPart, Microsoft.SharePoint.Portal, Version=15.0.0.0, Culture=neutral, PublicKeyToken=xxxxxx"/>
<AllowedItem Name="AllowedSandboxType" Assembly="System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxxxxx"/>
</AllowedListItems>
</SafeMode>