2

I am currently developing a solution in C# with a feature that uses the SharePoint API to create a number of sites, lists, list views etc. The final result is going to be used on SharePoint Online. Necessarily, this involves many lines of code (about 650 at the moment). So uploading the solution to SharePoint Online for testing every time I change 5 lines of code isn't going to cut it. Between tests in SharePoint Online, I test against a SharePoint 2010 Standard environment with sandboxed code deployment activated.

On my last 200-line update, activation of my feature succeeds in the SharePoint 2010 Standard environment. However, in SharePoint Online, I get

Error 
Sandboxed code execution request failed. 

Troubleshoot issues with Microsoft SharePoint Foundation. 

Correlation ID: 05d3094b-cc62-48e8-a289-a867cafbe4ff 

Date and Time: 5/9/2012 2:13:08 AM 

This shouldn't happen, since both environments use the sandboxed code service. Be that as it may, I need to find out what parts of my code violate the sandbox. Is there a better way of doing this than successively commenting out parts of my code and re-uploading the solution until it starts working again?

(Note: No exceptions are actually thrown during deployment. I have tried to log all exceptions to a SharePoint list in the site my feature works on, but no exceptions show up after I get this error message).

3
  • According to a poster at community.office365.com/en-us/f/153/t/20758.aspx they had to change the Solution ID to get it working again, tried that too? May 9, 2012 at 10:07
  • Changing the Solution ID does not resolve the problem. But you might be onto something - it seems like my solution suddenly gets rejected by the Sandboxed Code Service if it involves any code at all. With an empty FeatureActivated method it deploys, but if it contains "using (SPSite aSite = new SPSite("targetSiteCollection"))", it fails. This didn't happen before. May 9, 2012 at 10:34
  • Okay, turns out the error in my last comment was caused by an unrelated error. I've done some more testing, and the code seems to fail pretty randomly - if I comment out broad sections of code, it sometimes works and sometimes it doesn't. I've increased the resource quota of the site collection to the maximum, but this doesn't seem to improve things. Is there anything else that can cause this error message in SharePoint Online but not in a sandboxed server version? May 9, 2012 at 13:16

1 Answer 1

2

I have been able to create a workaround, although the reason for the failure is still unknown.

I suspected that the Sandboxed code service was acting up because my code performs a lot of requests in a short amount of time (it has to, since it creates a site from scratch). I still don't have an explanation why it works on the server installation, the sandbox resource quotas are much higher on my SharePoint Online site. I also attempted inserting multi-second delays between requests, to no avail.

In the end, splitting my solution up into three separate solutions which are installed and activated individually seemed to resolve the ssue. Classical SharePoint hack. If anyone has more information about this type of problem, I'd love to read it in the comments.

1
  • 2
    Splitting it up into separate solutions was probably the right approach. Heavily code-intensive operations in sandbox environment tend to be error-prone and unpredictable. Worse, they don't throw exceptions - they just 'stop'. May 11, 2012 at 15:24

Your Answer

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

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