NullreferenceException when opening SharePoint Document Library - sharepoint

After running the Configuration Wizard in SharePoint 2010 (had to do this because of permission issues) I cannot open any Document Library like "Pages". I receive the following Error:
[NullReferenceException: Object reference not set to an instance of an object.]
Microsoft.Office.Server.Administration.UserProfileApplicationProxy.get_ApplicationProperties() +134
Microsoft.Office.Server.Administration.UserProfileApplicationProxy.get_PartitionIDs() +44
Microsoft.Office.Server.Administration.UserProfileApplicationProxy.IsAvailable(SPServiceContext serviceContext) +329
Microsoft.Office.Server.WebControls.MyLinksRibbon.get_PortalAvailable() +44
Microsoft.Office.Server.WebControls.MyLinksRibbon.EnsureMySiteUrls() +60
Microsoft.Office.Server.WebControls.MyLinksRibbon.get_PortalMySiteUrlAvailable() +15
Microsoft.Office.Server.WebControls.MyLinksRibbon.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +65
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2427
A "normal" List can be opened without any problem. I alreade deactivated and re-activated "SharePoint Server Publishing" and "SharePoint Server Publishing Infrastructure"
Any idea?

It maybe has something to do with the User Profile Service Application.
look here:
http://www.codeproject.com/Articles/475253/Object-null-reference-error-when-opening-the-Site
According to this article, deleting the user profile service application fixes the error.

Related

Object reference not set to an instance of an object. When browsing to local site

i am getting this error when i try and navigate to my local dev site. but not sure what the exception is pointing. I've got the site set up in IIS similar to another site that works fine.
[NullReferenceException: Object reference not set to an instance of an object.]
umbraco.requestHandler..ctor(XmlDocument umbracoContent, String url) +3727
umbraco.UmbracoDefault.Page_PreInit(Object sender, EventArgs e) +1217
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Page.PerformPreInit() +48
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1843
The reason for this error is usually a missing or incomplete XML cache file which is located in the App_Data directory and called umbraco.config. Is this a new clean site with no content? If so then you need to login and publish something first. If you do have content then might I suggest regenerating the XML cache file by navigation to http://{yourhostname}/umbraco/dialogs/republish.aspx?xml=true
For further reference also see http://our.umbraco.org/wiki/reference/api-cheatsheet/publishing-and-republishing
NullReferenceException is thrown when you try to use a member or method of an object which is null. You need to initialize your relevant object before you use its members and methods. You should carefully check your code at the points shown in the trace pasted, find out why the exception is thrown and fix the problem.

System.Web.UI.Control.LoadRecursive() called may times in my user control or page

I have a user control on one of my page and I am getting below error on this page
Object reference not set to an instance of an object.
I have resolved this issue very easily but I found something strange in the stack trace of this error.
When I checked stack trace this was like below
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
It is not the complete stacktrace but a part of it. I want to know what is the role of this function "System.Web.UI.Control.LoadRecursive()". It is called 11 time and I am afraid that this may cause performance issue in my application. I think this function is called because I am using user control. I am using this kind of user controls at many places in my application.
Please tell me if any one knows about this.
LoadRecursive() makes a call to the current control's OnLoad() method and then will recursively call LoadRecursive() on all of its child controls, including those nested in the html.
So you will have 1 LoadRecursive() call on the stack for every parent control that has been passed through to get to your custom control. Composite controls can have many in one which will add to the depth.
It is not necessarily a performance problem. Just an indication of nesting depth.

ArgumentOutOfRangeException in Azure from System.Web.HttpCachePolicy.UtcSetLastModified (DateTime utcDate)

A project that is deployed in Azure recently started throwing two or three of these exceptions a day. My investigation shows that this is often caused by assemblies that have future timestamps on them, generally caused by deploying to machines in other timezones (this was a good resource). We have not had this problem before in the year+ that the app has been live, and it receives a lot more traffic than the handful of exceptions would suggest.
I redeployed with remote desktop enabled and checked the timestamps of our dlls and the contents of the \Windows\Microsoft.NET and \Windows\assembly directories, and did not find any "future" timestamps. At this point I'm stuck, and would be grateful for ideas.
Stack Trace:
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: utcDate
at System.Web.HttpCachePolicy.UtcSetLastModified(DateTime utcDate)
at System.Web.HttpCachePolicy.SetLastModified(DateTime date)
at System.Web.UI.Page.InitOutputCache(OutputCacheParameters cacheSettings)
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 System.Web.Mvc.OutputCacheAttribute.OnResultExecuting(ResultExecutingContext filterContext)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass27.b__24(IAsyncResult asyncResult)
at System.Web.Mvc.AsyncController.<>c__DisplayClass19.b__14(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.b__3(IAsyncResult ar)
at System.Web.Mvc.AsyncController.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.b__3(IAsyncResult ar)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.b__4(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.b__3(IAsyncResult ar)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Timezone issues are really a headache in Azure Environment so I suggest you to add a startup task and change Azure Environment's timezone. I'm not claiming this will resolve your problem but it doesn't hurt to try does it? To change Timezone of your Azure Environment:
1) Save tzutil /s "Pacific Standard Time" as .cmd and include the file to your project.
2) In properties screen of the file, choose "Copy Always" as your Copy to Output option and "None" as your Build Action.
3) Add the following to your ServiceDefinition file:
<Startup>
<Task commandLine="nameOfFileYouCreated.cmd" executionContext="elevated" />
</Startup>
4) And of course adapt your DateTime references in your project, you don't have to deal with conversions etc.

Specified method is not supported, iis 7.5 win 2008 r2

I ahve a code that was working just fine on iis7 windows 2008 32 bit but on iis7.5 i get below error every now and than. It looks like it is due to client disconnect but never had this error on old setup and there were client disconnect errors. It happens usually with simple post requests. I don't understand why system.drawing throws error. although some of those post requests are multi-part file/image uploads, most of them simple form posts.
Any one seen something like that?
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Web.HttpException: An error occurred while communicating with the remote host. The error code is 0x800703E3. ---> System.NotSupportedException: Specified method is not supported.
at System.Web.HttpResponseStream.get_Position()
at System.Drawing.UnsafeNativeMethods.ComStreamFromDataStream.Seek(Int64 offset, Int32 origin)
--- End of inner exception stack trace ---
at System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean throwOnDisconnect)
at System.Web.Hosting.IIS7WorkerRequest.ReadEntityCoreSync(Byte[] buffer, Int32 offset, Int32 size)
at System.Web.HttpRequest.GetEntireRawContent()
at System.Web.HttpRequest.FillInFormCollection()
at System.Web.HttpRequest.get_Form()
at System.Web.HttpRequest.get_HasForm()
at System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull)
at System.Web.UI.Page.DeterminePostBackMode()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
--- End of inner exception stack trace ---
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 ASP.mobile_chat_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Can add my custom webpart but then cannot modify any webpart on page

I`v made my webpart that works well (I can add it to page and use it). However if i want to move it to different zone or modify ANY other webpart on that page i get an exception.
Any ideas on what could be wrong?
Maybe it has to do something with that my web part has a null Zone variable? However webpart displays well on page. Details below.
Edit: Ahh, no, I see that other (original ones) web parts have Zone variable also as null. Anyway i have no idea how to even digg and find out the problem.
Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))
Exception Details: Microsoft.SharePoint.WebPartPages.WebPartPageUserException: Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))
Stack Trace:
[WebPartPageUserException: Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))]
Microsoft.SharePoint.WebPartPages.SPWebPartManager.SaveSomeChanges(SPLayoutProperties layoutProperties) +897
Microsoft.SharePoint.WebPartPages.WebPart.SaveSomeChanges(SPLayoutProperties layoutProperties) +52
Microsoft.SharePoint.WebPartPages.SPWebPartManager.WPSaveSomeChanges(SPLayoutProperties layoutProperties) +83
Microsoft.SharePoint.WebPartPages.SPWebPartManager.ApplyChangeList(String changeString) +865
Microsoft.SharePoint.WebPartPages.SPWebPartManager.OnLoad(EventArgs e) +398
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Try if any of the below solution works
this or
this or
this
Here's some troubleshooting thoughts:
Check the SharePoint logs
As the exception doesn't help much, you could try checking the SharePoint logs and see if there are any other errors occurring at the same time that aren't reported to the UI. These might give some more detail.
Break debugger on any exceptions
If no luck, try disabling Just My Code in Tools / Options / Debugging. This will ensure your code breaks when errors occur outside of your web part. Then set Debug / Exceptions to check for all CLR exceptions so that any exceptions that occur in SharePoint will break at the error. Finally attach the Visual Studio debugger to w3wp.exe and access your page. Be aware that the debugger will break on any exception, even those that are not related to this problem. Hopefully this will give you a clue.
Comment code
If that doesn't help to narrow down the problem, I would start commenting out the web part code until the error no longer occurs. Then uncomment until you reach the precise line that causes the error. As the exception is in SaveChanges, it's something to do with persisting the web part properties. That's where I'd start commenting out first.

Resources