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

You must have seen the below error while working with SharePoint 2010 webparts

"Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain"
Here is my take on this

1. Add [assembly:System.Security.AllowPartiallyTrustedCallersAttribute()] in your webparts assembly.cs file.

2. Correct your code - The code which is a sandbox solution has its own restrictions. Remove the method which is out of scope for sandbox or re-deploy the webpart as a farm solution.
If it is a SharePoint class method then in the detail error you can search for "MissingMethodException" which will give you the restricted class and the method name.

Here are some restrictions\limitations listed for sandbox solutions.

Happy Programming!

0 comments:

Post a Comment

Disclaimer

This is a personal weblog. The opinions expressed here represent my own and not those of my employer or anyone else. Should you have any questions or concerns please e-mail me at sharepointprogrammingblogger@gmail.com .

Copyright (c) 2010 @ myshaepointwork.blogspot.com. All rights are reserved.Do Not Copy.

@ Learning SharePoint.com