[Mono-bugs] [Bug 81314][Nor] New - SiteMapNode.GetStartNode error [w/ fix]

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Apr 4 20:55:27 EDT 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by mmorano at mikeandwan.us.

http://bugzilla.ximian.com/show_bug.cgi?id=81314

--- shadow/81314	2007-04-04 20:55:27.000000000 -0400
+++ shadow/81314.tmp.24371	2007-04-04 20:55:27.000000000 -0400
@@ -0,0 +1,74 @@
+Bug#: 81314
+Product: Mono: Class Libraries
+Version: 1.2
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.Web
+AssignedTo: mhabersack at novell.com                            
+ReportedBy: mmorano at mikeandwan.us               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: SiteMapNode.GetStartNode error [w/ fix]
+
+This method throws a NRE when you specify a SiteMapDataSource on a
+page/control that is configured such that 
+
+StartFromCurrentNode="true"
+ShowStartingNode="true"
+StartingNodeOffset="-1"
+
+The error expresses itself when the current url is not defined in the
+sitemap.  The problem is that with this set of conditions, a local variable
+to reference the starting node is set to Provider.CurrentNode (which is
+null).  This then goes on to cause the following stack trace:
+
+
+System.NullReferenceException: Object reference not set to an instance of
+an object
+  at System.Web.UI.WebControls.SiteMapDataSource.GetStartNode
+(System.String viewPath) [0x00000] 
+  at System.Web.UI.WebControls.SiteMapDataSource.GetView (System.String
+viewName) [0x00000] 
+  at
+System.Web.UI.WebControls.SiteMapDataSource.System.Web.UI.IDataSource.GetView
+(System.String viewName) [0x00000] 
+  at System.Web.UI.WebControls.Repeater.ConnectToDataSource () [0x00000] 
+  at System.Web.UI.WebControls.Repeater.Initialize () [0x00000] 
+  at System.Web.UI.WebControls.Repeater.OnPagePreLoad (System.Object
+sender, System.EventArgs e) [0x00000] 
+  at (wrapper delegate-invoke)
+System.MulticastDelegate:invoke_void_object_EventArgs (object,System.EventArgs)
+  at (wrapper delegate-invoke)
+System.MulticastDelegate:invoke_void_object_EventArgs (object,System.EventArgs)
+  at System.Web.UI.Page.OnPreLoad (System.EventArgs e) [0x00000] 
+  at System.Web.UI.Page.InternalProcessRequest () [0x00000] 
+  at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context)
+[0x00000] 
+
+
+The fix that works on my system is the following, as you can see it just
+returns Provider.RootNode when it detects a null starting node:
+
+
+Index: System.Web.UI.WebControls/SiteMapDataSource.cs
+===================================================================
+--- System.Web.UI.WebControls/SiteMapDataSource.cs      (revision 75379)
++++ System.Web.UI.WebControls/SiteMapDataSource.cs      (working copy)
+@@ -198,6 +198,11 @@
+                        else
+                                starting_node = Provider.RootNode;
+ 
++                       if(starting_node == null)
++                       {
++                               return Provider.RootNode;
++                       }
++
+                        int i;
+                        if (StartingNodeOffset < 0) {
+                                for (i = StartingNodeOffset; i < 0; i ++) {


More information about the mono-bugs mailing list