Unhandled exception was thrown by the sandboxed code wrapper’s Execute method in the partial trust app domain

I’ve been developing a sandboxed web part for SharePoint 2010.  The web part retrieves images from a SharePoint image library and uses Silverlight to display them in a slideshow.  I deployed the web part solution to the live environment and added it to a simple test page.  The web part displayed the images without error.  In preparation for the release of the web part I added it to the home page and configured an audience to hide the web part from all but a test group of users.  As soon as I added an audience to the web part it failed to load and just displayed an error.  Looking in the SharePoint log file showed the error below

01/17/2012 11:55:26.18 SPUCWorkerProcess.exe (0x8790) 0x92CC SharePoint Foundation Sandboxed Code Service fe8s Medium – – Unhandled exception was thrown by the sandboxed code wrapper’s Execute method in the partial trust app domain: An unexpected error has occurred. – userCodeWrapperType = “Microsoft.SharePoint.UserCode.SPUserCodeWebPartWrapper”, userAssemblyGroupId = “BCC815A08E2A4C64923709F32FA00B92-by0V1RUaCe3c88sryp9ER7slGEpZXlqosRuCBMbd6hY=”, siteCollectionId = “1eb54e14-572f-4fd9-a8e7-33b9869d3e96” – Inner Exception: Microsoft.SharePoint.UserCode.SPUserCodeSolutionProxiedException: Value cannot be null. Parameter name: path1 at System.IO.Path.Combine(String path1, String path2) at System.Web.HttpRawUploadedContent.TempFile..ctor() at System.Web.HttpRawUploadedContent.AddBytes(Byte[] data, Int32 offset, Int32 length) at System.Web.HttpRequest.GetEntireRawContent() at System.Web… 9b39d39d-ebb5-4ddd-9387-efff7785962b

01/17/2012 11:55:26.18* SPUCWorkerProcess.exe (0x8790) 0x92CC SharePoint Foundation Sandboxed Code Service fe8s Medium ….HttpRequest.GetMultipartContent() at System.Web.HttpRequest.FillInFormCollection() at System.Web.HttpRequest.get_Form() at System.Web.HttpRequest.get_HasForm() at System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) at System.Web.UI.Page.DeterminePostBackMode() at Microsoft.SharePoint.UserCode.SPUserCodePage.DeterminePostBackMode() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 9b39d39d-ebb5-4ddd-9387-efff7785962b

01/17/2012 11:55:26.18 SPUCHostService.exe (0x6404) 0x97F0 SharePoint Foundation Sandboxed Code Service 0000 Medium – – Value cannot be null. Parameter name: path1 – Request executing userSolution Id “bcc815a0-8e2a-4c64-9237-09f32fa00b92″ for site collection id ” 1eb54e14-572f-4fd9-a8e7-33b9869d3e96″ has encountered an unhandled exception while executing user code. 9b39d39d-ebb5-4ddd-9387-efff7785962b

Searching Google indicated that the error could be due to the size of the HTTP request.   In order to resolve the error I opened the sandbox solution web.config file in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\UserCode\web.config.  I added <httpRuntime requestLengthDiskThreshold = “4096” /> to the system.web section of the file according to the information here http://msdn.microsoft.com/en-us/library/e1f13641.aspx .

 

Advertisements

One thought on “Unhandled exception was thrown by the sandboxed code wrapper’s Execute method in the partial trust app domain

  1. Pingback: contentquerywebpart crashes sandbox webpart | DL-UAT

Comments are closed.