Thursday, June 17, 2010

SharePoint 2010 Phantom Web Part Error

I've been playing around with SharePoint 2010 visual web parts and I happened to find that one of my old—and deleted—sample parts was still (unsuccessfully) being loaded on the server. The web part did not exist on the page (at least it didn’t appear anywhere in published or edit more) and it had been deleted from the web part galleries.

I stumbled across the error when I enabled the SharePoint  2010 developer dashboard on the home page of my server. The web part errors appeared in the “Asserts and Critical Events” section of the dashboard.

To get rid of the error, I put the page in edit mode and removed all the white space (just a line break or two from the main content area on the page. (I also added and removed a different web part, but I’m not sure that it had any effect.) Now I don’t get the error… crazy.

image                               - The developer dashboard no longer shows any critical errors

Here’s the error from the SharePoint developer dashboard:

Web Parts 18 7935 http://sp2010/SitePages/Home.aspx - An unexpected error has been encountered in this Web Part.  Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type VisualWebPartProject2.VisualWebPart1.VisualWebPart1, VisualWebPartProject2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=50d4a10608bc4e38 could not be found or it is not registered as safe., Source: [UnsafeControlException: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type VisualWebPartProject2.VisualWebPart1.VisualWebPart1, VisualWebPartProject2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=50d4a10608bc4e38 could not be found or it is not registered as safe.]<br/>&#160;   at Microsoft.SharePoint.ApplicationRuntime.SafeControls.GetTypeFromGuid(Guid guid, Guid solutionId, String assemblyFullName, String typeFullName, Boolean throwIfNotFound)
<br/>&#160;   at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)

2 comments:

Unknown said...

I'll look into this!

Stephen Cawood said...

I don't usually approve bogus comments, but the first one here is pretty funny.

If you're gonna pretend to be someone from Microsoft (however tongue in cheek), why would you use a gmail address?

Anyway... made me laugh. Good on ya.