[Mono-bugs] [Bug 445156] New: Monodoc doesn't handle correctly Node instances that don' t have any child nodes

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Nov 14 11:14:22 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=445156


           Summary: Monodoc doesn't handle correctly Node instances that
                    don't have any child nodes
           Product: Mono: Doctools
           Version: SVN
          Platform: x86
        OS/Version: Ubuntu
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Core
        AssignedTo: mario.sopena at gmail.com
        ReportedBy: etienne.fortin at sympatico.ca
         QAContact: mono-bugs at lists.ximian.com
          Found By: Development


Description of Problem:
This problem manifested itself while trying latest revision of Monodevelop from
SVN repository. When starting I get this message. After splash screen MD will
vanish:

System.TypeInitializationException: An exception was thrown by the type
initializer for MonoDevelop.Projects.Dom.Parser.ProjectDomService --->
System.NullReferenceException: Object reference not set to an instance of an
object
  at Monodoc.RootTree.LoadTree (System.String basedir) [0x0025c] in
/tmp/mono2-build.21095/monobuild/monodoc-117204/engine/provider.cs:851 
  at Monodoc.RootTree.LoadTree () [0x0005c] in
/tmp/mono2-build.21095/monobuild/monodoc-117204/engine/provider.cs:761 
  at MonoDevelop.Projects.Dom.Parser.ProjectDomService..cctor () [0x00000]
in
/tmp/mono2-build.964/monobuild/md-svn/main/src/core/MonoDevelop.Projects/MonoDevelop.Projects.CodeGeneration/BaseRefactorer.cs:1 
  --- End of inner exception stack trace ---
  at MonoDevelop.Ide.Gui.Pads.ClassPad.ProjectNodeBuilder.Initialize ()
[0x00017] in
/tmp/mono2-build.964/monobuild/md-svn/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ProjectNodeBuilder.cs:57 
  at MonoDevelop.Ide.Gui.Components.NodeBuilder.SetContext
(ITreeBuilderContext context) [0x00007] in
/tmp/mono2-build.964/monobuild/md-svn/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/NodeBuilder.cs:47 


Steps to reproduce the problem:
1. Compile latest revision of Monodoc or use latest package.
2. Compile latest revision of Monodevelop or use latest package.
3. Launch Monodevelop.
4. After the splash screen, Monodevelop will crash in Monodoc with a above
descripbed error.


Actual Results:
Crash after splash screen.

Expected Results:
Monodevelop finish booting and works.


How often does this happen? 
Every time Monodevelop is launched.


Additional Information:
The place where the NullReferenceException comes from is the following line
in provider.cs (@851), in LoadTree() method of RootTree class:

..
NullRef --->            foreach (Node n in hs.Tree.Nodes){
                                        parent.AddNode (n);
                                }
..

It can be hs that is null (HelpSource). I verified, it can't. It can be
hs.Tree. I verified, it can't. Then only Nodes property can return null. If
you look at the LoadNodes() method of the Node class...

..
        public void LoadNode ()
        {
                if (position < 0)
                        position = -position;

                tree.InputStream.Position = position;
                BinaryReader reader = tree.InputReader;
                int count = DecodeInt (reader);
                element = reader.ReadString ();
                caption = reader.ReadString ();
--->            if (count == 0)
                        return;

                nodes = new ArrayList (count);
                for (int i = 0; i < count; i++){
                        int child_address = DecodeInt (reader);

                        Node t = new Node (this, -child_address);
                        nodes.Add (t);
                }
        }
..

You see there's the if(count == 0) line. So if count == 0, meaning there's
no nodes attached to that node (I guess it's a valid situation, no childs),
then Nodes will be null. I commented out this if, compiled Monodoc again, et
voilà! it works. Now if there's no node, Nodes = new ArrayList(0).


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list