I have a web part with around 700+ controls (text boxes and text areas). There are two buttons Save and Submit. Save and Submit will save the data from the list to the associated lists using CAML queries and SharePoint object Model.

It worked fine few days back. But right now I am seeing issues with the Saving part. Whenever I save or submit the web part is not loading at all and throwing an error

"Web Part Error: Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred."

I dont see any errors in savings part and other page load section. Exception handling is managed properly but nothing helped me because web part is not at all loading on click of save.

Any help is greatly appreciated.

2 Answers 2


As Alexander says it could be related to a class not allowed in Sandboxed. But since you says it has worked before, it could be another reason too. I have seen that error when a Sandboxed Solution takes to much time to execute vs the different measures in the resource usage limits.

Does the WebPart throw that error when you hit save or does it take some time before it throws the error(30sec+)?

  • Hi, when I hit save, page is trying to refresh for some time and then it finally redirects to the error that I specified above. As per my research I got to know that there might be problem with save mechanism which is taking too much time to execute OR the view state is grown too high to load the page on postback thru a button click. I verified the resource limit of the solution in settings. It has not exceeded the limit for solution scope but might be the resource limit for an individual web part is exceeded? Please let me know you thoughts here... Feb 15, 2012 at 10:35
  • Yeah, there is a default timeout for Sandboxed, I think the default is 30secs before it timesout. If your code haven't finished before the timeout limit it will fail. The SPUserCodeService.Local.WorkerProcessExecutionTimeout setting Feb 15, 2012 at 14:34
  • 1
    Here is a link for how you change the different settings with powershell: 0ut0ftheb0x.wordpress.com/2011/01/09/… Feb 15, 2012 at 14:37
  • I'd suspect a resource issue as well. 700 controls sounds like a lot of processing going on for a sandbox solution. And this issue tends to cause a 'silent failure' which is consistent with your not seeing any caught exceptions May 26, 2012 at 6:10

This exception tells that your code calls class or method which is not permitted for sandbox solution.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.