As I was developing my sandboxed solution, I used my local development environment to compile, deploy and test my solution. All was well and my solution was working the way I wanted it to.
So, time to deploy to SharePoint Online. I created a fresh new site, uploaded my solution and activated my feature. Wait a bit… And a bit more… Exception 🙁
After some browsing around, I found this post on stackoverflow. Basically, the sandbox has a timeout property for long running operations. This timeout is set to 30 seconds. Apparantly, the SharePoint Online sandbox runs slower than my local process does and therefore my actions (creating two subsites through the object model) timeout and cause an error. Retrying the activation of my feature sometimes works, sometimes it doesn’t. That’s probably caused by the load on the sandbox user code service at the moment I try to run my code.
Workaround? There is none. So when your action takes more than 30 seconds, you’re kind of done. The only thing I can think of (and will try next) is deploying all subsites in seperate hidden features which are automatically activated when you set them as dependencies for your main feature. But I’ve got little hope this will actually work, since those feature receivers will have the same restrictions and will thus probably fail just as hard.
The sandbox, what can you say…