Error: “SharePoint Foundation cannot deserialize the Web Part”

Here’s another one of those “Why didn’t I ever figure this out before?” things. Many times when I’m editing pages in SharePoint Designer and everything is going along swimmingly, suddenly I hear the Jaws theme and I get an error like this:

SNAGHTML3b45b3c

One of the properties of the Web Part has an incorrect format. Microsoft
SharePoint Foundation cannot deserialize the Web Part. Check the format of the
properties and try again.

Of course, the error message is as clear as mud. What happens is that SharePoint Designer messes with the properties of a Web Part, making them unintelligible to SharePoint on the server.

Here’s what I mean. If you look at the code below, you’ll see that the values for the properties are not on the same line as the tags which enclose them.

image

In this closer view, I’ve added arrows pointing to two instances of the issue, though every line from 133-141 demonstrates the problem.

image

The fix is amazingly simple, but a little tedious. All you need to do is fix the code so that the tags enclose the values again, and you’re good to go.

SNAGHTML3bdc8be

I haven’t figured out a pattern where SharePoint Designer decides to go all flaky on me like this other than “it does it sometimes”. It’s yet another reason to commit to keeping your code nice and clean and well-formatted so that you can spot issues like this easily.

Enhanced by Zemanta

Similar Posts

8 Comments

  1. You can make it a little less tedious by right clicking in code view and selecting: Reformat XML

    Of course you’ll need to copy and paste your code into a .xml, .xsl, or .xslt file, but that’s less tedious than the alternative.

    Cheers,
    Matt

    1. Matt:

      It’s not that bad doing it by hand. It probably would take me longer to copy it out somewhere else to do it. The other nice side effect of doing it by hand is that I can read the parameters that the Web Part uses and learn something from it.

      M.

  2. Marc, I’m so glad you figured this out. I have had to scrap and start over many times because of this “feature” when customizing with SPD. If 50% of becoming fluent in most technologies is knowing the idiosyncrasies and workarounds then with SharePoint (which I’m new to) it seems to be the case 75% (or 90% some days). Don’t get me wrong, I’m a believer and really like how SharePoint 2010, SharePoint Designer, Access 2010, SSIS, and even InfoPath 2010 are enhancing my departments data driven solutions and expanding our user base, but these types of tips and tricks are much more valuable to me then the most of the generic resources available thus far.

    Any book recommendations (especially if on Safari Books) or URL’s that get into more of the “workarounds” necessary for specific SharePoint Designer 2010 tasks?

  3. Marc,

    You’ve helped me one more time, thanks! In fact I believe the same is happening in SharePoint 2013 Design Manager. This is where I saw it!

    Do you know if there is a fix for it for SharePoint 2013?

    Thanks,
    Maher

    1. Maher:

      I haven’t run into this error in a long time, and definitely not when I’ve been working with SharePoint 2013. But I wouldn’t be surprised to see it. I suppose the fix is the same: simply reformat the XML.

      M.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.