null reference exception stack
Can any one explain this exception?
Server Error in '/eims_web' Application:
Object reference not set to an instance of an object.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:
System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +24
System.Xml.XmlDocument.Load(XmlReader reader) +108
System.Web.UI.WebControls.XmlDataSource.PopulateXmlDocument(XmlDocument document, CacheDependency& dataCacheDependency, CacheDependency& transformCacheDependency) +342
System.Web.UI.WebControls.XmlDataSource.GetXmlDocument() +253
System.Web.UI.WebControls.XmlHierarchicalDataSourceView.Select() +51
System.Web.UI.WebControls.Menu.DataBindItem(MenuItem item) +326
System.Web.UI.WebControls.Menu.PerformDataBinding() +99
System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect() +126
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +125
System.Web.UI.WebControls.Menu.DataBind() +29
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +104
System.Web.UI.WebControls.Menu.EnsureDataBound() +70
System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +43
System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e, Boolean registerScript) +89
System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e) +63
System.Web.UI.Control.PreRenderRecursiveInternal() +200
System.Web.UI.Control.PreRenderRecursiveIntern开发者_如何学Pythonal() +322
System.Web.UI.Control.PreRenderRecursiveInternal() +322
System.Web.UI.Control.PreRenderRecursiveInternal() +322
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4837
Without seeing your code it is going to be hard to say, but by the looks of the stack trace, I will wager a guess and say you have a TreeView/Menu bound to an XmlDataSource
.
Clearly something is going wrong during the databinding process, but again without seeing your code that populates the XmlDataSource
it is going to be next to impossible to assist you further.
The XmlReader
instance passed from XmlDocument.Load
to XmlLoader.Load
is null, which means that XmlDataSource.PopulateXmlDocument
passes a null reader to XmlDocument.Load
, which occurs when XmlDataSource.GetReader
returns null.
The only code path where this happens requires that XmlDataSource.DataFile
is null or empty and XmlDataSource.Data
is either null, empty or costs of only white-space characters.
精彩评论