Getting null reference exception when try to open list settings (Listedit.aspx) for Sharepoint 2010

This is a typical  error scenario that you have if you move or copy some sharepoint core dll’s which is referenced fr0m another folder.There is common mistake when developing custom applications that moving and copying sharepoint core dll’s to where is not in original folder (for example coping Microsoft.Sharepoint.dll to BIN folder of web application)  or unnecesserly register in GAC (for example registering Microsoft.Sharepoint.ApplicationPages.dll to GAC).

Why is this dangerous ? i can simply say when you upgrade or install any patch on sharepoint , the copied dlls form original location  can not be upgraded  by default .So this cause a huge anomality in your system. DLL version integrity is very important issue for every Microsoft product. So be careful for this operations , after all if you still need to copy or move operation, that upgrading copied dlls is your responsibility.

So lets keep going with our error :

when you click the one of list’s list settings (listedit.aspx) you can probably getting fallowing error in application event logs:

Exception information:
Exception type: NullReferenceException
Exception message: Object reference not set to an instance of an object.

Stack trace:    at Microsoft.SharePoint.ApplicationPages.ListEditPage.SetSectionLinks()
at Microsoft.SharePoint.ApplicationPages.ListEditPage.OnLoad(EventArgs e)
at ASP._layouts_listedit_aspx.OnLoad(EventArgs e) in c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\listedit.aspx:line 25
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

And if you enable custom errors from  in your web.config which is in Layouts folder.You can see the error in browser:

NullReferenceException: Object reference not set to an instance of an object.]
Microsoft.SharePoint.ApplicationPages.ListEditPage.SetSectionLinks() +426
Microsoft.SharePoint.ApplicationPages.ListEditPage.OnLoad(EventArgs e) +896
ASP._layouts_listedit_aspx.OnLoad(EventArgs e) +290
System.Web.UI.Control.LoadRecursive() +65
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2427

For resolving this issue you should find the related copied assembly files which according this scenario is Microsoft.Sharepoint.ApplicationPages.dll in use for unfamiliar locations.

the orginal location for this dll is  Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\BIN

1) First Check the GAC this dll should not be added to GAC if it is upgrade latest correct version or delete the dll.
2) Check other possible existance may it be used in BIN folders of web applications. For getting all list of any dll location you can use this script:
http://blog.bugrapostaci.com/2011/12/26/powershell-find-files-with-versions/ this powershell command gives you a list that defined dll locations and versions.

For best practise if you need any reference to Sharepoint DLL’s use and reference them in original locations .if not you always remember to upgrade latest versions where it have been that is your resposibility.

See you next time.

 

 

 

 

 

 

Advertisements

Moss 2007 – Troubleshooting incoming email problems

Windows SharePoint Services 3.0 uses e-mail handlers to route incoming e-mail from virtually any e-mail client to a list in your SharePoint site. Each e-mail-enabled list is associated with a unique e-mail address, and each e-mail handler is associated with a particular list type.

For troubleshooting incoming e-mails

1) Check Central Administration ->  Operations -> Incoming E-Mail Settings  is correctly configured.

2) Check your library – Settings-> Incoming E-mail settings is correctly configured.

If you correctly enable Incoming emails settings, you should have also an installed smtp server feature (for Windows server 2008 r2)
At this point i want to tell about the process of an incoming email distribution. When you send an email to a sharepoint list first your mail is delivered by your mail server and pass through the your sharepoint machine smtp server. It stored c:\inetpub\mailroot\drop folder with a file format of eml. The timer job of “Windows SharePoint Services Incoming E-Mail” is monitoring your mailroot\drop folder and when it find an email it process this mail and deliver the attachments to destination document library.

3) Check your Mailroot/drop folders stores eml files.

Incoming e-mail uses the Microsoft SharePoint Directory Management Service to connect SharePoint sites to the directory services used by your organization. If you enable the Microsoft SharePoint Directory Management Service, users can create and manage distribution groups from SharePoint sites. SharePoint lists that use e-mail can then be found in directory services, such as the Address Book. You must also select which distribution group requests from SharePoint lists require approval. The Microsoft SharePoint Directory Management Service can be installed on a server in the farm, or you can use a remote Microsoft SharePoint Directory Management Service.

4) If you are using Microsoft SharePoint Directory Management Service  Check Microsoft SharePoint Directory Management Service is running.

5) Check your sharepoint timer service identity has correct rights on mailroot folders. (you can check it from services.msc)

6) Trace the log messages using ULSViewer program with a filter of “category equals E-Mail”

For more information of Configuring Incoming E-Mail Settings:
http://technet.microsoft.com/en-us/library/cc287879(office.12).aspx

 

Sharepoint Debug Settings

If you want to open debug messages for a sharepoint application
edit your application web.config file.

[Drive]:\inetpub\wwwroot\wss\VirtualDirectories\[YourSite]\web.config

Make CallStack true: 
<SafeMode MaxControls="200" CallStack="true" DirectFileDependencies="10" 
TotalFileDependencies="50" AllowPageLevelTrace="false">

Set debug true:
<compilation batch="false" debug="true">

set mode off:
<customErrors mode="Off" />

That’s all