Continuable, Null Reference Exception problem with CuteSoft Editor

Last post 10-23-2006, 12:24 PM by davidMi. 4 replies.
Sort Posts: Previous Next
  •  10-19-2006, 7:18 PM 23726

    Continuable, Null Reference Exception problem with CuteSoft Editor

    hello all...
    I'm experiencing a truly bizarre problem... i think i figured out a work around, but I thought i'd post this just in case there was something I was missing...
     
    I have a fairly good sized application running a couple instantiations of the editor.  ASP.net 1.1.  I instantiate the editor programmatically, and set autoconfigure to none ... as in:
     
       CuteEditor.Editor editor = new CuteEditor.Editor();
       editor.AutoConfigure = AutoConfigure.None;
     
    The problem, is that if I set a breakpoint at the second line, many of the properties have null references!!!
    Unfortunately, I cannot repro this with the CuteDemo, which comes with the distribution.
     
    I have a screenshot of the debugger, showing a couple of the null reference exceptions, if you are interested.
     
    The following editor properties are all null immediately after editor instantiation:
       ClientID
       FrameId
       ToolBarID
       ToolControls
     
    The thing is, the exceptions are continuable.  If, in the 'immediate' window of the debugger, you look at 'editor.ToolControls', the first time it spits out the ToolControls object, the first line will be a notification of a null reference exception (with the rest of the object dumped just fine).  The second time you look at the object, it dumps the entire object with no problem.
     
    I found it because right after the instantiation, I try to insert a couple of custom editor buttons.  The first thing I did to do this was to get the position of a button that was already there from the ToolControls Collection. as follows:
     

    int pos= editor.ToolControls.IndexOf("insertcustombutonhere") + 1;
    StringBuilder oString =
    new StringBuilder();

     
    When I just run the program, it would give me a yellow screen, indicating that I couldn't get editor.ToolControls.IndexOf, because the object reference was null.  Whenever I put a breakpoint at 'int pos=...', and inspected the editor and toolControls object, everything seemed fine, and I could continue with no problems, and no yellow screen.  HOWEVER, whenever I would put a breakpoint at the next line, I would get a yellow screen from the preceding line!!!
     
    My work around is to instantiate the ToolControls object within a try/catch, catch the exception and then just go on... like so:
     
       string EMSG = null;
       try
       {
        CuteEditor.ToolControlCollecton coll = editor.ToolControls;
       }
       catch (Exception eCutesoft)
       {  
        EMSG = "I caught an exception!!!... " + eCutesoft.Message;
       }
       int pos= editor.ToolControls.IndexOf("insertcustombutonhere") + 1;
       StringBuilder oString = new StringBuilder();
     
    I know that the exception is being thrown, because I can set a breakpoint at 'EMSG=...', and it always gets there, and the eCuteSoft.Message is always... null reference exception.
     
    So, my question is: has anyone ever seen this before?  Is there something I should do to load the object, or maybe ensure the object's initialization?
     
    specifics:
       windows xp, sp2
       .net framework v 1.1.4322
       ms dev environment 2003, v 7.1.3088
  •  10-20-2006, 2:49 PM 23745 in reply to 23726

    Re: Continuable, Null Reference Exception problem with CuteSoft Editor

  •  10-21-2006, 8:20 AM 23752 in reply to 23745

    Re: Continuable, Null Reference Exception problem with CuteSoft Editor

    I'd be happy to post it, but, it's a very long file, and of course you wouldn't be able to build it.
     
    I could send it to you if you want.
  •  10-21-2006, 11:57 AM 23753 in reply to 23752

    Re: Continuable, Null Reference Exception problem with CuteSoft Editor

  •  10-23-2006, 12:24 PM 23772 in reply to 23753

    Re: Continuable, Null Reference Exception problem with CuteSoft Editor

    thanks so much for offering to look at this.  I've sent you the file.  Please let me know if you find anything. 
View as RSS news feed in XML