If you are getting “Method not found” (MissingMethodException) error in SharePoint 2010

“Method not found” error i admit its my favorite ūüôā If you get this MissingMethodException from any of your build in SharePoint assembly for example below “Microsoft.SharePoint.Library” the first place you may check the dlls versions. This error usually caused by some version mismatch¬†between¬†your related dll version and SharePoint version.

You can see the error samples below:
Exception information:
Exception type: MissingMethodException
Exception message: Method not found: ‘Void Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(System.String, System.String, Boolean, Boolean, Boolean, Boolean, Boolean, Int32 ByRef, System.String ByRef, System.Guid, Boolean, System.String, System.Object ByRef, System.Object ByRef, System.Object ByRef, Boolean, Boolean, Boolean, Boolean, System.String, Microsoft.SharePoint.Library.ISP2DSafeArrayWriter, Microsoft.SharePoint.Library.ISP2DSafeArrayWriter, Microsoft.SharePoint.Library.ISP2DSafeArrayWriter)’.

Stack trace:    at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bPreserveItemUIVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)
   at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32& ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAfterEvents, String filename, Boolean bPreserveItemUIVersion)
   at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents, String filename, Boolean bPreserveItemUIVersion)
   at Microsoft.SharePoint.SPListItem.Update()
   at Microsoft.SharePoint.WebControls.SaveButton.SaveItem(SPContext itemContext, Boolean uploadMode, String checkInComment)
   at Microsoft.SharePoint.WebControls.SaveButton.OnBubbleEvent(Object source, EventArgs e)
   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

So what could cause this issue
1) Unsuccessful upgrade or a corrupted installation.
2) Custom solutions that referenced old dlls
3) Deploying SharePoint solutions which is accidentally overwriting old dll on new version.
4) Unnecessery GAC registrations for build-in SharePoint DLLs

In this scenario we don’t have any custom solutions . So we may facing with first issue above, so how to fix the issue:
1) Define that which dll in use and this exception has thrown up. Answer for this scenario is “Microsoft.SharePoint.Library.dll”
2) Check the all dll versions in your system and compare with your SharePoint Build Number from Central Administration- > Migration and Upgrade -> Check product installation and patch status.
Here you can find powershell commands for searching versions of specific file in your system.
http://blog.bugrapostaci.com/2011/12/26/powershell-find-files-with-versions/
3) Correct dll version if you have orginal version of this old dll.
or
4) Upgrade your SharePoint for  newer version of Cumulative Update than your build will solve this issue.

By the way if you are thinking the problem caused by a Custom Solution you may check fallowing article:
http://blog.bugrapostaci.com/2011/12/28/getting-null-reference-exception-when-try-to-open-list-settings-listedit-aspx-for-sharepoint-2010/

Have a nice day.

 

Advertisements