Friday, October 1, 2010

Most annoying error message in SharePoint development

How much do you hate this error message: "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."?

If you are like me, creating lots of SharePoint web parts - you must have seen this hundreds of times.

See my old post on this issue: unable to add selected web part(s)

It does not give you any useful information as to what went wrong, you cannot debug it and basically you were blind folded to resolve this issue on your own.

What if I tell you, that there is a way to get the internal error message that will let you know exactly what you did wrong in code, DWP, or anywhere else?

Well, as I have learned today - there is such a way, and it is rather simple.

First, you have to make sure your server shows complete error messages and not these nice custom error page. Simply edit your web.config (back it up first!) and change CallStack="false" to CallStack="true", and also change the to

Now, you install your web part, try to add it to a web part page and boom – this happens…
The trick is, to go to site collection settings -> Galleries -> Web parts and find your web part definition there.

Once found – click on the file name link to get a detailed error page with stack trace and everything!

Note, that you will get a complete error message the first time:

And the same limited information all other times:

So be sure to keep the error page open first time until you got all the info you need!

Strange, but at least we got something!


Satish Nagpal said...

Hi Shai,
Nice Solution. But in my case I'm I have not deployed any custom webpart even though I'm getting same error and bcoz of that my all websites stop working. The interesting things is here is when I restart my server its works fine for couple of hours but after that its all stop working.

Pls, help

Shai Petel said...

I would check event log and sharepoint log files - I guess your web part code causes the application pool process to fail.

The logs should have more info I am sure.

If you need more help I think it is better to take this offline, I will send you my contact info.

Satish Nagpal said...

I got following message:

WcfSendRequest: RemoteAddress: 'http://worf:32843/f33d5ae7c0a64bcb9f04414fa8ce7d55/MetadataWebService.svc' Channel: 'Microsoft.SharePoint.Taxonomy.IMetadataWebServiceApplication' Action: '' MessageId: 'urn:uuid:19b0e80f-12bc-4bad-a3a8-05cd06d26905'

Ravi said...

Thanks, Shai, this a great solution. However, I need to know which web.config to alter.

I found several web.config files, and I have changed them all, but am still seeing the dialog box, not the detailed message.

Please let me know the location of the web.config to change.

Thanks a tonne!

Shai Petel said...

Hi Ravi,

You should go to your c:\inetpub\wwwroot\wss\ folder, under virtual directories you should have all of SharePoint web application folders, each with its own web.config file.
If you are not sure which folder belongs to which site, you should check in your IIS configuration.

Just make sure, that if you have multiple servers and you are using a load balancer, that you change the web.config on all servers OR that you browse to the server you changed it on, and not through the NLB.

If you changed all web.config files within that folder it has to work, if it doesnt - double check you are on the correct server.

Good luck!

Ravi said...

Thanks, Shai. That worked.

In my case the error was because I had a line reading a value from app.config, which was failing to find the entry in the Config file. But the error message ("One of the properties of the Web Part has ...") had left me clueless.

Thanks a tonne, again!