I tried to create some private variables that were SPUser's, but I was given an error to the tune of 'SPUser is not marked as Serializable'.


I know these objects contain a lot of contextual information that could be invalid when deserialized.


My guess would be exactly what you suggest: those objects rely heavily on a valid SharePoint context in order to function. While you can obviously use the current context to serialize an object, there is no guarantee that you will have the same context (or any context) when it is being deserialized, which would leave the new object in an unstable state.

| improve this answer | |
  • Does it mean that I can't serialize SPFile in web service? – Gennady G Feb 23 '12 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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