This post was migrated from an older system. Some links may point to content that no longer exists. Comments were not migrated.
Today, I was working on a new application that needed to adjust some properties on a web part.
Pretty straightfoward code - open file, check it out, update web part properties, check back in.
Unfortunately, I ran across a bug (eventually traced to my code). The code would run successfully, but web parts started disappearing from my pages. Whenever the application ran, each part that was updated would systematically disappear.
On a wiki pages, whenever an ErrorWebPart is encountered, the web part is never displayed. If you open the contents page (append "?contents=1" to your page url), you will see the appropriate error information.
Unforunately, the user never sees the error on the rendered page. Worse yet, if you open the page for edit and save the page, the part is permanently deleted. No questions asked.
That is in effect data loss.
Wiki-bound web parts should render an error web part. Error web parts should not be automatically removed from the page when the page is edited. It's too bad the operational design does not mimic that of parts that are rendered in web part zones, where the user is made aware of the problem and they can elect to wait for the problem to resolve or remove the web part manually.
Consider the scenario where the part stops rendering due to a temporary problem. What happens if the hosting page is edited during the problem? Part is removed. What happens service is then resolved? User experience is completely different. Someone has to go back and readjust the page.
In my scenario, all I did was set the Height/Width values. The only problem was that our code set the values to a percentage value, which then caused the web part to choke. In a normal web part page with zones, the error web part would have rendered with the following message:
Web Part Error: The Height and Width properties do not support proportional metrics (for example, 20%).
The automated process worked as expected and coupled with the wiki behavior, web parts just started disappearing... quickly... it took us longer to discover the problem in our logic than if we had been dealing with traditional zones.
ErrorWebParts are valuable - please don't throw them away w/o asking. :)