SharePoint Development Bookmark and Share   
 index > SharePoint - Development and Programming > WebPart error "Windows Sharepoint Services Cannot Deserialize the WebPart"
 

WebPart error "Windows Sharepoint Services Cannot Deserialize the WebPart"

Hello,

I've created 2 custom WebParts:

-The firstis an abstract class based on the WebPart in Microsoft.Sharepoint.WebPartPages.

-The second is a sub class which implements the first.

-Both contain a public property called "UniqueKey". The property in the second WebPart hides the underlying property using the "new" modifier.

This property is for use in WebPart connections and I don't reallywantSharepoint use it in the Toolpart etc. so I tried setting [Browsable(false), WebPartStorage(Storage.None) in both the sub class and the parent class. My problem is that whenever I try and add the WebPart to the page I get the error:

One of the properties has an incorrect format. Windows Sharepoint Services cannot deserialize the web part. Check the format of the properties and try again.

I've tried fiddling around with the attributes on the property but whatever I change doesn't seem to make a difference.

Can anyone help?

Thanks very much

O11y  Tuesday, July 08, 2008 8:34 AM

Hi,

Thanks for this. I ended up ditching the properties and using a Get() method instead. After doing this I discovered that an Exception was being thrown in the constructor (in the top catch {} block no less) which was making it impossible to initialize the class. Because of all the polymorphism and complex types being exchanged I pressumed that the serializer was falling over somewhere but I imagine it was just crashing because it couldn't create an instance in order to even start the process...doh!

Just as an aside I think that if you use [WebPartStorage(Storage.None)] then this should fix the problem but without deleting all my new methods and going back to properties I won't be able to test this.

Cheers,

  • Marked As Answer byO11y Monday, July 28, 2008 10:36 AM
  •  
O11y  Tuesday, July 08, 2008 4:36 PM

Can you post the properties you are using in your web part? I had this problem a few days ago but I cant remember what exactly it was. Seeing the properties might refresh my memory.

Maybe this link would be of help:

http://support.microsoft.com/kb/826786

jasear [MCTS SharePoint]  Tuesday, July 08, 2008 4:07 PM

Hi,

Thanks for this. I ended up ditching the properties and using a Get() method instead. After doing this I discovered that an Exception was being thrown in the constructor (in the top catch {} block no less) which was making it impossible to initialize the class. Because of all the polymorphism and complex types being exchanged I pressumed that the serializer was falling over somewhere but I imagine it was just crashing because it couldn't create an instance in order to even start the process...doh!

Just as an aside I think that if you use [WebPartStorage(Storage.None)] then this should fix the problem but without deleting all my new methods and going back to properties I won't be able to test this.

Cheers,

  • Marked As Answer byO11y Monday, July 28, 2008 10:36 AM
  •  
O11y  Tuesday, July 08, 2008 4:36 PM

You can use google to search for other answers

Custom Search

More Threads

• manage cache
• How to use SPHierarchyDataSourceControl??
• ASP.NET caching in Sharepoint
• Best practice for remotely load and save from a SharePoint Document Library
• Enable variation into the Wss
• breakpoint not reached
• How to Add a ToolBar of type "Summary Toolbar" to a ListViewWebPart through code
• is this possible in CAML?
• web part user properties programatically
• sharepoint jacascript overwriting