In my current production code, we have the following that was working perfectly fine:
XsltListViewWebPart clientInfoWebPart = new XsltListViewWebPart();
                                    clientInfoWebPart.Title = "Client Info";
                                    clientInfoWebPart.WebId = web.ID;
                                    clientInfoWebPart.ListName = clientInfoListSP.ID.ToString("B").ToUpper();
                                    clientInfoWebPart.ChromeType = PartChromeType.TitleOnly;
                                    clientInfoWebPart.Toolbar = "None";
                                    clientInfoWebPart.XmlDefinition = clientInfoHomePageview.GetViewXml();
                                    clientInfoWebPart.ViewGuid = clientInfoHomePageview.ID.ToString("B").ToUpper();
                                    clientInfoWebPart.Hidden = true;
                                    mgrPageManager.AddWebPart(clientInfoWebPart, "Header", 0);
                                    mgrPageManager.SaveChanges(clientInfoWebPart);
Howeever, after SP1 was installed, we got this issue, in the SaveCHanges line.
(Object reference not set to an instance of an object.) System.NullReferenceException   
 at Microsoft.SharePoint.WebPartPages.BaseXsltListWebPart.EnsureView()    
 at Microsoft.SharePoint.WebPartPages.XsltListViewWebPart.get_View()    
 at Microsoft.SharePoint.WebPartPages.SPWebPartManager.SaveChangesCore(SPLayoutProperties layoutProperties, Boolean httpGet, Boolean saveCompressed, Boolean skipRightsCheck, Boolean skipSafeAgainstScriptCheck, WebPartTypeInfo& newTypeId, Byte[]& newAllUsersProperties, Byte[]& newPerUserProperties, String[]& newLinks)    
 at Microsoft.SharePoint.WebPartPages.SPWebPartManager.SaveChangesInternal(SPLayoutProperties layoutProperties, Boolean skipRightsCheck, Boolean skipSafeAgainstScriptCheck)    
 at Microsoft.SharePoint.WebPartPages.SPWebPartManager.SaveChanges(Guid storageKey)    
 at Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager.SaveChanges(WebPart webPart)    
Question is, whats happening here? How can I fix it? Do I need the save changes? Why was it working without throwing the exception PRE-SP1 and now its failing!?
 
     
     
     
    