I've created a Full Trust Proxy to help out a sandbox feature that needs to deploy a lot of list view web parts on activation, because full trust has access to SPLimitedWebPartManager and sandbox code does not.

Now I'm getting a System.TypeLoadException for the SPLimitedWebPartManager type when I try to execute my proxy:

Microsoft.SharePoint.UserCode.SPUserCodeSolutionProxiedException: Could not load type 'Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager' from assembly 'Microsoft.SharePoint, Version=15.900.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.

I can see that it's referencing version 15.900.0.0, and according to this other answer, 15.900.0.0 is the sandbox version of the SharePoint DLL, and I need to be referencing the full version,

Also, similarly to that answer, I can see in my VS project that the reference in the project is to the version, and my project properties show "Sandboxed Solution: False", so I am getting no compile-time errors.

How can I get my code to reference and load the correct full trust version of Microsoft.SharePoint.dll at run time?

1 Answer 1


And the answer is.... (trumpet fanfare)...

RTFM and call the proxy operation in the correct way:

string proxyAssembly = "four part assembly name";
string proxyType = "fully qualified type name";
MyProxyArgs myArgs = new MyProxyArgs("some args");
Object result = SPUtility.ExecuteRegisteredProxyOperation(proxyAssembly, proxyType, myArgs);

rather than the way I was doing it:

MyProxyArgs myArgs = new MyProxyArgs("some args");
MyProxyOperation proxy = new MyProxyOperation();
Object result = proxy.Execute(myArgs);

I guess that by calling it directly it was getting executed by the SPUCWorkerProcess process (sandbox), instead of getting handed off to the SPUCWorkerProcessProxy process (full trust) as it should have been.

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.