I'll make a small test case and file this, but in the meantime, does MS already know about this?
I am writing a descending class of the XmlSiteMapProvider, and in the GetChildNodes method
that I'm overriding, I first call base.GetChildNodes, which returns a ReadOnlySiteMapNodeCollection.
But I need to modify it, so I call the copy constructor of SiteMapNodeCollection, which leaves me with
this error.
Server Error in '/Web' Application.
Specified cast is not valid.
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.InvalidCastException: Specified cast is not valid.
Source Error:
Line 29: if (evaluationPage != null && childNodes.Contains(evaluationPage)) Line 30: { Line 31: SiteMapNodeCollection myChildNodes = new SiteMapNodeCollection(childNodes); Line 32: int index = myChildNodes.IndexOf(evaluationPage); Line 33: myChildNodes.Remove(evaluationPage);
|
Source File: c:\Documents and Settings\ala55\My Documents\iFolder\wc\RelateInstitute\Web\App_Code\QuestionnaireSiteMapProvider.cs Line: 31
Stack Trace:
[InvalidCastException: Specified cast is not valid.] System.Web.SiteMapNodeCollection.System.Collections.ICollection.CopyTo(Array array, Int32 index) +12 System.Collections.ArrayList.InsertRange(Int32 index, ICollection c) +130 System.Collections.ArrayList.AddRange(ICollection c) +14 System.Web.SiteMapNodeCollection..ctor(SiteMapNodeCollection value) +112 Byu.Fhss.Sfl.RelateInstitute.Web.Providers.QuestionnaireSiteMapProvider.GetChildNodes(SiteMapNode node) in c:\Documents and Settings\ala55\My Documents\iFolder\wc\RelateInstitute\Web\App_Code\QuestionnaireSiteMapProvider.cs:31 System.Web.SiteMapNode.get_ChildNodes() +19 System.Web.UI.WebControls.SiteMapDataSource.GetNodes() +361 System.Web.UI.WebControls.SiteMapDataSource.GetPathNodeCollection(String viewPath) +36 System.Web.UI.WebControls.SiteMapDataSource.GetView(String viewName) +34 System.Web.UI.WebControls.SiteMapDataSource.System.Web.UI.IDataSource.GetView(String viewName) +7 System.Web.UI.WebControls.Repeater.ConnectToDataSourceView() +304 System.Web.UI.WebControls.Repeater.OnLoad(EventArgs e) +17 System.Web.UI.Control.LoadRecursive() +49 System.Web.UI.Control.LoadRecursive() +132 System.Web.UI.Control.LoadRecursive() +132 System.Web.UI.Control.LoadRecursive() +132 System.Web.UI.Control.LoadRecursive() +132 System.Web.UI.Control.LoadRecursive() +132 System.Web.UI.Control.LoadRecursive() +132 System.Web.UI.Control.LoadRecursive() +132 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3695
|
Version Information: Microsoft .NET Framework Version:2.0.50215.44; ASP.NET Version:2.0.50215.44
Andrew L Arnott
.NET Compact Framework