SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 0 down vote accepted

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.

share|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 posting your answer, you agree to the privacy policy and terms of service.

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