‘Type is not marked as Serializable’ error!

I have just installed Windows Server 2008 as my main OS to avoid the hassle of waiting for the VM to load up and the slow environment on the guest OS.  So the next task at hand was to configure my environment with MOSS 2007 with FBA configured, well that all went nice until I was trying to deploy my solution to my SharePoint site, then things started to get a bit interesting.  My previous environment I had WSS 3.0 running and I have my solution working on there like a charm, now I upgraded my environment to have MOSS 2007 (which is WSS 3.0 with a lot more features) and was ready to use my custom application pages that were deployed via wsp solution into my SharePoint site.  A couple of the custom app pages were using Gridviews in them, and they started giving me this weird serialization error:

Type ‘type‘ in Assembly ‘assembly‘ is not marked as serializable.   at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)
at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)

and it was driving me absolutely nuts, I was checking my config files over and over to make sure that I didnt miss any of the FBA or profile related configurations, I was checking the database and my stored procedures over and over, and then debuged my code several times and had some help from my collegue Michael Lotter (SharePoint Dev and Admin genious), and nothing came up, I researched a bit about the error and blogs were talking about things not related to SharePoint at all so I started thinking thats something is really wrong with my code.  But then I read a article about a customer for Telerik complaining about a similar issue in the following url:

http://www.telerik.com/community/forums/thread/b311D-tdhgt.aspx

and in there they said something about the <sessionState > and the mode not being supported, so I went and compared my 2 web.config files again, and found that in WSS 3.0 my web.config for the my web app did not have that entry in there, but my new web.config for MOSS 2007 did.  So I commented that line out and it worked like a charm 🙂

Leave a comment