1

In SharePoint 2013 page, under Page edit mode, when I try to add my custom Web Part, I got following error as shown in picture:

enter image description here

Then I append ?contents=1 at the end of Page URL: http://mysite/default.aspx and deleted the corrupt Web Part and Page successfully renders. But when I again try to add web part, i got same error again. what is reason behind that error? As web part is working perfectly in development server but throwing this error on production?

Any idea to fix this

ULS Logs show this Error:

System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object. at WebPart.CreateChildControls() at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at Microsoft.SharePoint.Publishing.TemplateRedirectionPage.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 8982fe9c-5128-705c-e45e-037aad81de5b"

SharePoint Foundation Runtime tkau Unexpected System.NullReferenceException: Object reference not set to an instance of an object. at WebPart.CreateChildControls() at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 8982fe9c-5128-705c-e45e-037aad81de5b"

5
  • You need to look into log files for exact issue. Apr 22, 2015 at 12:20
  • Without knowing what your web part does, you could be missing a dependancy the web part relies on, like a list or a library, that is in the dev environment but not in production. Apr 22, 2015 at 12:27
  • As i have 20 site collections and on every site collection, this web part renders successfully except on one site collection. all the libraries/lists on which this web part relies are available under root site collection. why just on one site collection it throws error??? any idea?
    – SPBeginer
    Apr 22, 2015 at 13:59
  • After viewing ULS Logs: I got this error: But i have no idea how to fix this:' See my updated question
    – SPBeginer
    Apr 22, 2015 at 14:27
  • Try checking application pool account permissions on db, which hosts this very site collection. It appears like a permission issue. Apr 22, 2015 at 20:05

1 Answer 1

1

Your WebPart has error's, check the ULS logs, it Says ystem.NullReferenceException: Object reference not set to an instance of an object. at WebPart.CreateChildControls() and so on.

You add your webpart in a test Page, and Then attach the (W3Wp)worker process to debug the code, Attach the breakPoint on Load and OnInit method, Then start debugging you will find which line of code is throwing null value and due to this Null value the WebPart is throwing the error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.